-- @Author: 作者QQ381990860
-- @Date:   2021-10-15 11:42:07
-- @Last Modified by:   作者QQ381990860
-- @Last Modified time: 2022-09-26 02:14:47

全局变量 = {
    基础属性 = {"体质","魔力","力量","耐力","敏捷"},
    资质标识 = {"体资","攻资","防资","法资","速资","躲资"},
    战斗属性 = {"伤害","命中","防御","灵力","速度","躲闪","当前气血","气血上限","最大气血","当前魔法","魔法上限"},
    修炼名称 = {"法术","法抗","攻击","防御","猎术"},
    附属性 = {"伤害","气血","魔法","灵力"}}
function file_exists(path) ---检查文件是否存在
  path=ServerDirectory..path
  local file = io.open(path, "rb")
  if file then file:close() end
  return file ~= nil
end
function ReadFile(fileName)
    fileName=ServerDirectory..fileName
    local f = assert( io.open(fileName, 'r'))
    local content = f:read("*all")
    f:close()
    return content
end
function 发送数据(a,b,c)
  if a == nil then
    return
  end
  发送数据(a,b,c)
end
function 取随机数(q, w)
  随机序列 = 随机序列 + 1
  if q == nil or w == nil then
    q = 1
    w = 100
  end
  math.randomseed(tostring(os.clock() * os.time() * 随机序列))
  return math.random(math.floor(q), math.floor(w))
end
-----------------------------------
--取星光护符名称--取月光护符名称--取阳光护符名称--取银河加护名称

function 取星光护符名称()

local 临时技能 = {}
local 临时技能表 = {
         [1] ="终极防御",
     [2] ="终极反击",
     [3] ="终极必杀",
     [4] ="终极吸血",
     [5] ="终极强力",
     [6] ="终极偷袭",
     [7] ="终极法术暴击",
     [8] ="终极法术波动",
     [9] ="终极夜战",
    [10] ="终极感知",
    [11] ="终极法术连击",
    [12] ="终极幸运",
    [13] ="终极连击",
    [14] ="终极敏捷",
    [15] ="终极神佑复生",
    [16] ="终极魔之心",
    [17]="终极慧根",
        [18]="终极冥思",
        [19]="终极遗志",
        [20]="终极再生"
}

local 编号 = math.random(#临时技能表)
临时技能[1] = 临时技能表[编号]
table.remove(临时技能表,编号)


 if math.random(100)<=10 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)

 end



return 临时技能

end




function 取月光护符名称()
local 临时技能 = {}
local 临时技能表 = {
         [1] ="终极防御",
     [2] ="终极反击",
     [3] ="终极必杀",
     [4] ="终极吸血",
     [5] ="终极强力",
     [6] ="终极偷袭",
     [7] ="终极法术暴击",
     [8] ="终极法术波动",
     [9] ="终极夜战",
    [10] ="终极感知",
    [11] ="终极法术连击",
    [12] ="终极幸运",
    [13] ="终极连击",
    [14] ="终极敏捷",
    [15] ="终极神佑复生",
    [16] ="终极魔之心",
    [17]="终极慧根",
        [18]="终极冥思",
        [19]="终极遗志",
        [20]="终极再生"
}

local 编号 = math.random(#临时技能表)
临时技能[1] = 临时技能表[编号]
table.remove(临时技能表,编号)


 if math.random(100)<=50 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)

 end

 if math.random(100)<=10 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

 if math.random(100)<=5 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end


return 临时技能

end




function 取阳光护符名称()
local 临时技能 = {}
local 临时技能表 = {
         [1] ="终极防御",
     [2] ="终极反击",
     [3] ="终极必杀",
     [4] ="终极吸血",
     [5] ="终极强力",
     [6] ="终极偷袭",
     [7] ="终极法术暴击",
     [8] ="终极法术波动",
     [9] ="终极夜战",
    [10] ="终极感知",
    [11] ="终极法术连击",
    [12] ="终极幸运",
    [13] ="终极连击",
    [14] ="终极敏捷",
    [15] ="终极神佑复生",
    [16] ="终极魔之心",
    [17]="终极慧根",
        [18]="终极冥思",
        [19]="终极遗志",
        [20]="终极再生"
}

local 编号 = math.random(#临时技能表)
临时技能[1] = 临时技能表[编号]
table.remove(临时技能表,编号)


 if math.random(100)<=50 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)

 end

 if math.random(100)<=10 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

 if math.random(100)<=5 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

  if math.random(100)<=4 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

  if math.random(100)<=1 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end



return 临时技能

end




function 取银河加护名称()
local 临时技能 = {}
local 临时技能表 = {
         [1] ="终极防御",
     [2] ="终极反击",
     [3] ="终极必杀",
     [4] ="终极吸血",
     [5] ="终极强力",
     [6] ="终极偷袭",
     [7] ="终极法术暴击",
     [8] ="终极法术波动",
     [9] ="终极夜战",
    [10] ="终极感知",
    [11] ="终极法术连击",
    [12] ="终极幸运",
    [13] ="终极连击",
    [14] ="终极敏捷",
    [15] ="终极神佑复生",
    [16] ="终极魔之心",
    [17]="终极慧根",
        [18]="终极冥思",
        [19]="终极遗志",
        [20]="终极再生"
}

local 编号 = math.random(#临时技能表)
临时技能[1] = 临时技能表[编号]
table.remove(临时技能表,编号)


 if math.random(100)<=50 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)

 end

 if math.random(100)<=15 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

 if math.random(100)<=10 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

  if math.random(100)<=5 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

  if math.random(100)<=3 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

  if math.random(100)<=1 then
    local 临时编号 = math.random(#临时技能表)
  临时技能[#临时技能+1] = 临时技能表[临时编号]
    table.remove(临时技能表,临时编号)
 end

return 临时技能



end

function 取打宝价格(名称)

local 临时价格 = 0

if 名称 == "江湖少侠称谓礼包"  then  临时价格 =1000
elseif 名称 == "随机星光护符"  then  临时价格 =1500
elseif 名称 == "随机月光护符"  then  临时价格 =3000
elseif 名称 == "随机阳光护符"  then  临时价格 =5000
elseif 名称 == "随机银河加护"  then  临时价格 =15000
elseif 名称 == "宝宝材料大礼包"  then  临时价格 =2000
elseif 名称 == "江湖大侠称谓礼包"  then  临时价格 =2000
elseif 名称 == "江湖豪侠称谓礼包"  then  临时价格 =3000
elseif 名称 == "武林高手称谓礼包"  then  临时价格 =5000
elseif 名称 == "孤独求败称谓礼包"  then  临时价格 =5000
elseif 名称 == "天外飞仙称谓礼包"  then  临时价格 =5000
elseif 名称 == "武林盟主称谓礼包"  then  临时价格 =5000
elseif 名称 == "大内密探称谓礼包"  then  临时价格 =5000
elseif 名称 == "皓月战神称谓礼包"  then  临时价格 =5000
elseif 名称 == "笑傲江湖称谓礼包"  then  临时价格 =20000
elseif 名称 == "随机锦衣礼包"  then  临时价格 =3000
elseif 名称 == "随机脚印礼包"  then  临时价格 =3000
elseif 名称 == "随机光环礼包"  then  临时价格 =3000
elseif 名称 == "随机真·锦衣礼包"  then  临时价格 =8000
elseif 名称 == "随机真·脚印礼包"  then  临时价格 =8000
elseif 名称 == "随机真·光环礼包"  then  临时价格 =8000
elseif 名称 == "三界密录"  then  临时价格 =2000
elseif 名称 == "150级玩家礼包"  then  临时价格 =3000
elseif 名称 == "160无级别礼包"  then  临时价格 =5000
elseif 名称 == "160双加120礼包"  then  临时价格 =15000
elseif 名称 == "160双加150礼包"  then  临时价格 =20000
elseif 名称 == "超级神兽定制24礼包"  then  临时价格 =10000
elseif 名称 == "十二技能定制攻宠礼包"  then  临时价格 =6000
elseif 名称 == "150双加50礼包"  then  临时价格 =3000
elseif 名称 == "150双加80礼包"  then  临时价格 =4000
elseif 名称 == "150双加100礼包"  then  临时价格 =5000
elseif 名称 == "150双加120礼包"  then  临时价格 =8000
elseif 名称 == "元神突破丹"  then  临时价格 =1000
elseif 名称 == "固神丹"  then  临时价格 =3000
elseif 名称 == "随机法宝礼盒"  then  临时价格 =3000
elseif 名称 == "十二随机技能胚子"  then  临时价格 =8000
elseif 名称 == "150双加150礼包"  then  临时价格 =10000
elseif 名称 == "圣级神兽定制24礼包"  then  临时价格 =50000
elseif 名称 == "超级飞天礼包"  then  临时价格 =1000
elseif 名称 == "超级神马礼包"  then  临时价格 =1000
elseif 名称 == "超级神鼠礼包"  then  临时价格 =1000
elseif 名称 == "超级猪小戒礼包"  then  临时价格 =1000
elseif 名称 == "超级神猪礼包"  then  临时价格 =1000
elseif 名称 == "超级小白龙礼包"  then  临时价格 =1000
elseif 名称 == "超级神龙礼包"  then  临时价格 =1000
elseif 名称 == "超级青鸾礼包"  then  临时价格 =1000
elseif 名称 == "超级赤焰兽礼包"  then  临时价格 =1000
elseif 名称 == "超级神鸡兽礼包"  then  临时价格 =1000
elseif 名称 == "GM随机定制礼包"  then  临时价格 =3000
elseif 名称 == "善恶点化石礼包"  then  临时价格 =3000
elseif 名称 == "剑荡四方点化石礼包"  then  临时价格 =3000
elseif 名称 == "高级神佑复生点化石礼包"  then  临时价格 =3000
elseif 名称 == "帝级神兽定制24礼包"  then  临时价格 =30000
elseif 名称 == "二十四随机技能胚子"  then  临时价格 =15000
elseif 名称 == "二十四技能定制法宠礼包"  then  临时价格 =15000
elseif 名称 == "二十四技能定制攻宠礼包"  then  临时价格 =15000
elseif 名称 == "特殊兽决宝盒"  then  临时价格 =5000
elseif 名称 == "定制法宠礼包"  then  临时价格 =10000
elseif 名称 == "定制攻宠礼包"  then  临时价格 =10000
elseif 名称 == "灵饰防御佩饰礼包"  then  临时价格 =10000
elseif 名称 == "灵饰防御手镯礼包"  then  临时价格 =10000
elseif 名称 == "灵饰气血手镯礼包"  then  临时价格 =10000
elseif 名称 == "灵饰伤害戒指礼包"  then  临时价格 =15000
elseif 名称 == "灵饰物理暴击戒指礼包"  then  临时价格 =15000
elseif 名称 == "灵饰物理暴击耳饰礼包"  then  临时价格 =15000
elseif 名称 == "灵饰法术伤害戒指礼包"  then  临时价格 =15000
elseif 名称 == "灵饰法术暴击戒指礼包"  then  临时价格 =15000
elseif 名称 == "灵饰法术暴击耳饰礼包"  then  临时价格 =15000
elseif 名称 == "灵饰治疗能力耳饰礼包"  then  临时价格 =10000
elseif 名称 == "灵饰治疗能力戒指礼包"  then  临时价格 =10000
elseif 名称 == "灵饰气血佩饰礼包"  then  临时价格 =10000
elseif 名称 == "特殊兽决宝盒"  then  临时价格 =5000
elseif 名称 == "特殊魔兽要诀礼包"  then  临时价格 =5000
elseif 名称 == "160双加100礼包"  then  临时价格 =15000
elseif 名称 == "高级孩子名册"  then  临时价格 =15000
elseif 名称 == "孩子王名册"  then  临时价格 =50000
end

return 临时价格
end


-----------------------------------
function 取召唤兽饰品(mx)
 if mx == "野猪"or mx == "羊头怪"or mx == "吸血鬼"or mx == "马面"or mx == "牛头"or mx == "黑山老妖"or mx == "雷鸟人"or
   mx == "古代瑞兽"or mx == "白熊"or mx == "进阶白熊"or mx == "天兵"or mx == "碧水夜叉"or mx == "鲛人"or mx == "雨师"or mx == "蛟龙"or
   mx == "凤凰"or mx == "锦毛貂精"or mx == "犀牛将军人形"or mx == "犀牛将军兽形" or mx == "如意仙子"or mx == "星灵仙子"or
   mx == "巡游天神"or mx == "百足将军"or mx == "鼠先锋"or mx == "野猪精" or mx == "镜妖"or mx == "阴阳伞"or mx == "灵符女娲"or
   mx == "律法女娲"or mx == "幽灵"or mx == "幽萤娃娃"or mx == "画魂"or mx == "鬼将"or mx == "净瓶女娲"or mx == "金铙僧"or
   mx == "大力金刚"or mx == "夜罗刹" or mx == "灵鹤"or mx == "噬天虎"or mx == "雾中仙"or mx == "炎魔神"or mx == "葫芦宝贝"or
   mx == "机关人"or mx == "蝎子精"or mx == "狂豹兽形"or mx == "猫灵兽形"or mx == "红萼仙子"or mx == "龙龟"or mx == "巴蛇" or
   mx == "机关鸟"or mx == "机关兽"or mx == "长眉灵猴"or mx == "混沌兽"or mx == "巨力神猿"or mx == "狂豹人形"or mx == "猫灵人形"or
   mx == "藤蔓妖"or mx == "修罗傀儡鬼"or mx == "蜃气妖"or mx == "金身罗汉"or mx == "曼珠沙华"or mx == "修罗傀儡妖"or mx == "般若天女"or
   mx == "持国巡守"or mx == "灵灯侍者"or mx == "增长巡守"or mx == "真陀护法"or mx == "进阶古代瑞兽"or mx == "进阶黑山老妖"or
   mx == "进阶蝴蝶仙子"or mx == "进阶雷鸟人"or mx == "进阶地狱战神"or mx == "进阶风伯"or mx == "进阶天兵"or mx == "进阶天将"or
   mx == "进阶蚌精"or mx == "进阶碧水夜叉"or mx == "进阶凤凰"or mx == "进阶雨师"or mx == "进阶蛟龙"or mx == "进阶鲛人"or
   mx == "进阶千年蛇魅"or mx == "进阶如意仙子"or mx == "进阶犀牛将军人形"or mx == "进阶犀牛将军兽形"or mx == "进阶星灵仙"or
   mx == "进阶巡游天神"or mx == "进阶芙蓉仙子"or mx == "进阶百足将军"or mx == "进阶镜妖"or mx == "进阶鼠先锋"or mx == "进阶野猪精"or
   mx == "进阶灵符女娲"or mx == "进阶律法女娲"or mx == "进阶吸血鬼"or mx == "进阶阴阳伞"or mx == "进阶鬼将"or mx == "进阶画魂"or
   mx == "进阶净瓶女娲"or mx == "进阶大力金刚"or mx == "进阶金铙僧"or mx == "进阶噬天虎"or mx == "进阶雾中仙"or mx == "进阶炎魔神"or
   mx == "进阶机关人"or mx == "进阶龙龟"or mx == "进阶踏云兽"or mx == "进阶蝎子精"or mx == "进阶巴蛇"or mx == "进阶机关鸟"or
   mx == "进阶机关兽"or mx == "进阶连驽车"or mx == "进阶长眉灵猴"or mx == "进阶混沌兽"or mx == "进阶巨力神猿"or mx == "进阶猫灵人形"or
   mx == "进阶修罗傀儡鬼"or mx == "进阶金身罗汉"or mx == "进阶修罗傀儡妖"or mx == "进阶般若天女"or mx == "进阶灵灯侍者"or mx == "进阶毗舍童子" or
   mx == "进阶小魔头"or mx == "进阶小精灵"or mx == "进阶小仙女"or mx == "进阶小神灵"or mx == "进阶小毛头"or mx == "进阶小丫丫" or mx == "猪八戒"or
   mx == "章鱼"or mx == "山贼"or mx == "泡泡"or mx == "进阶夜罗刹"or mx == "进阶犀牛将军兽"or mx == "进阶曼珠沙华"or mx == "进阶连弩车"or mx == "机关人战车"or
   mx == "海星"or mx == "风伯"or mx == "碧海夜叉"or mx == "蚌精"or mx == "进阶锦毛貂精"or mx == "进阶星灵仙子"or
   mx == "进阶幽灵"or mx == "进阶幽萤娃娃"or mx == "进阶灵鹤"or mx == "进阶葫芦宝贝"or mx == "进阶狂豹兽形" or mx == "进阶猫灵兽形"or
   mx == "进阶红萼仙子"or mx == "进阶狂豹人形"or mx == "进阶藤蔓妖"or mx == "进阶蜃气妖"or mx == "进阶持国巡守"or mx == "进阶增长巡守"or mx == "进阶真陀护法" or mx == "毗舍童子" or mx == "芙蓉仙子" or mx == "进阶灵鹤"
   or mx == "暗黑童子" or mx == "进阶暗黑童子"  or mx == "超级小鲲鹏"  or mx == "进阶超级小鲲鹏" or mx == "进阶迭代天兵"or mx == "迭代天兵" or mx == "鬼将靓"or mx == "进阶鬼将靓"or mx == "大力金刚靓"or mx == "进阶大力金刚靓"or mx == "进阶天兵靓"or mx == "天兵靓"or mx == "进阶暗黑童子"or mx == "暗黑童子"or mx == "进阶武神坛童子"or mx == "武神坛童子"or mx == "进阶白豹"or mx == "白豹"then
     return  true
   else
      return  false
   end
end
function 检查高级副本(id)
    if 角色处理类:GetTaskID(玩家数据[id],"地府救猴王1") ~= 0 then
        角色处理类:取消任务(玩家数据[id],角色处理类:GetTaskID(玩家数据[id],"地府救猴王1"))
                任务数据[角色处理类:GetTaskID(玩家数据[id],"地府救猴王1")] = nil
  end
  if 角色处理类:GetTaskID(玩家数据[id],"地府救猴王2") ~= 0 then
      角色处理类:取消任务(玩家数据[id],角色处理类:GetTaskID(玩家数据[id],"地府救猴王2"))
                任务数据[角色处理类:GetTaskID(玩家数据[id],"地府救猴王2")] = nil
  end
  if 角色处理类:GetTaskID(玩家数据[id],"地府救猴王3") ~= 0 then
      角色处理类:取消任务(玩家数据[id],角色处理类:GetTaskID(玩家数据[id],"地府救猴王3"))
                任务数据[角色处理类:GetTaskID(玩家数据[id],"地府救猴王3")] = nil
  end
  if 角色处理类:GetTaskID(玩家数据[id],"地府救猴王4") ~= 0 then
      角色处理类:取消任务(玩家数据[id],角色处理类:GetTaskID(玩家数据[id],"地府救猴王4"))
                任务数据[角色处理类:GetTaskID(玩家数据[id],"地府救猴王4")] = nil
  end
  if 角色处理类:GetTaskID(玩家数据[id],"地府救猴王5") ~= 0 then
      角色处理类:取消任务(玩家数据[id],角色处理类:GetTaskID(玩家数据[id],"地府救猴王5"))
                任务数据[角色处理类:GetTaskID(玩家数据[id],"地府救猴王5")] = nil
  end
  if 角色处理类:GetTaskID(玩家数据[id],"地府救猴王6") ~= 0 then
      角色处理类:取消任务(玩家数据[id],角色处理类:GetTaskID(玩家数据[id],"地府救猴王6"))
                任务数据[角色处理类:GetTaskID(玩家数据[id],"地府救猴王6")] = nil
  end
 end

 function 检查边境(id)
    if 角色处理类:GetTaskID(玩家数据[id],"边境救援") ~= 0 then
        角色处理类:取消任务(玩家数据[id],角色处理类:GetTaskID(玩家数据[id],"边境救援"))
            任务数据[角色处理类:GetTaskID(玩家数据[id],"边境救援")] = nil
  end

      for n, v in pairs(任务数据) do
      if 任务数据[n] ~= nil  and (任务数据[n].类型 == "边境救援1" or 任务数据[n].类型 == "边境救援2" or 任务数据[n].类型 == "边境救援3") and 任务数据[n].id == id then
        地图处理类:移除单位(7099, n)
        任务数据[n] = nil
      end
    end

 end
function WriteFile(fileName,content)
     fileName=ServerDirectory..fileName
    local f = assert( io.open( fileName, 'w'))
    f:write(content)
    f:close()
end

function 取任务人物和地图()
  local  maps = 地图处理类.MapID[math.random(1,#地图处理类.MapID)]
   local  npc
   if MapData[maps] and MapData[maps].NPC and (not 取可用任务地图(maps)) then
       npc = MapData[maps].NPC[math.random(1,#MapData[maps].NPC)]
   else
       maps,npc=取任务人物和地图()
   end
   return maps,npc
end

function 取副本地图(map)
  if map==3131 or map == 3132 or map == 4131 or map == 4132 or map == 4133 or map == 7100 or map == 7101 or map == 7102  or map == 7103 or map == 7104 or map == 7105 or map == 7106  or map == 7099 then
     return true
  end
end
function 取可用任务地图(map)
  if map==3131 or map == 3132 or map == 7099 or map == 4131 or map ==1217 or map == 4132 or map == 4133 or map == 11355 or map == 11354 or map == 11353 or map == 11352 or map == 11351
   or map == 6003 or map == 6002 or map == 6001 or map == 5135 or map == 1875 or map == 1865 or map == 1845 or map == 1835 or map == 1825 or map == 1815 then
     return true
  end
end

function 取经验差(基础等级, 比较等级)
    local 等级差 = math.abs(基础等级 - 比较等级)
    if 等级差 < 5 then
        return 1
    elseif 等级差 < 10 then
        return 0.8
    elseif 等级差 < 20 then
        return 0.5
    else
        return 0.1
    end
end

function 给予随机道具(IsNull,...)
      if IsNull and math.random(100)<IsNull then
        return false ---表示空车
      else
          local arg =...
      end
end
function 是否绑定(名称)

     if 名称 == nil then
     return true
   end



     if 名称 == "聚宝盒" then
     return true
    elseif 名称 == "三界密录" then
     return true
    elseif 名称 == "金银宝盒" then
     return true
    elseif 名称 == "摸金符" then
     return true
    elseif 名称 == "烧烤牛肉" then
     return true
     elseif 名称 == "烧烤羊肉" then
     return true
     elseif 名称 == "烧烤猪肉" then
     return true
     elseif 名称 == "烧烤鸭肉" then
     return true
   end
   return false
end
function 置技能(名称,护符)
  if 名称 == nil then
    return
  end
  if type(名称) == "table" then
    名称 = 名称.名称
  end
  local n = assert(SkillData[名称],string.format("置技能错误名称=%s请检查数据表",名称))

  local Skill ={}
  Skill.名称 = 名称 Skill.种类 = n.类型
  if Skill.种类 == 0 then
    Skill.包含技能 = {}
  end
  if Skill.种类 ~= 8 and Skill.种类 ~= 7 then
    Skill.学会 = false
  end

  if 护符 ~= nil then
    Skill.护符 = true
  end

  return Skill
end

function 增加在线时间()
  local 人数 = 0
    for n, v in pairs(玩家数据) do
        if  v.角色 and  not v.假人 then
          人数 = 人数 + 1
  if 人数 >= 3 then--网关断线
      os.exit()
      end


            v.秒=v.秒+1
                if v.秒 >= 60 then
                  v.秒 = 0
                   if v.角色.等级 >= 69 then
            v.战令.当前经验=v.战令.当前经验+1
       发送数据(v.连接id,7,"#y/泡点增加战令经验1点")
       end
    --- 角色处理类:添加储备(v,10000,"泡点增加")
                  v.分 = v.分 + 1
                  if 取是否整除(v.分, 5) then
                    v.角色.宠物.经验 = v.角色.宠物.经验+3
                      if v.角色.宠物.经验 >= v.角色.宠物.最大经验 and v.角色.宠物.等级 < 175 then
                            v.角色.宠物.等级 = v.角色.宠物.等级 +1
                            v.角色.宠物.最大耐力 = v.角色.宠物.最大耐力 +10
                            v.角色.宠物.耐力 = v.角色.宠物.最大耐力
                            v.角色.宠物.最大经验 =取宠物经验(v.角色.宠物.等级)
                            v.召唤兽.数据.召唤兽上限 = math.floor(v.角色.宠物.等级/25+3)+v.召唤兽.数据.扩充
                      end
                    v.角色.宠物.耐力 = v.角色.宠物.耐力+5
                    if v.角色.宠物.耐力 >= v.角色.宠物.最大耐力 then
                    v.角色.宠物.耐力 = v.角色.宠物.最大耐力
                    end
                    v.角色.当前体力 = v.角色.当前体力 + math.floor(v.角色.体力上限 * 0.05)
                    if v.角色.体力上限 < v.角色.当前体力 then
                      v.角色.当前体力 = v.角色.体力上限
                    end
                    v.角色.当前活力 = v.角色.当前活力 + math.floor(v.角色.活力上限 * 0.05)
                    if v.角色.活力上限 < v.角色.当前活力 then
                      v.角色.当前活力 = v.角色.活力上限
                    end
                  end
                  if 取是否整除(v.分, 10) then
                    v.角色.人气 = v.角色.人气 + 1
                    if v.角色.人气 > 800 then
                      v.角色.人气 = 800
                    end
                  end
                  if v.分 >= 60 then
                    v.分 = 0
                    v.小时 = v.小时 + 1
                  end
                end
                v.在线时间 = v.小时 .. "时" .. v.分 .. "分" .. v.秒 .. "秒"
        end
    end
end

function 可坐骑(人物,种族,坐骑)
  if 坐骑 == "宝贝葫芦" then
    return true
  elseif 坐骑 == "神气小龟" then
    if 人物 ~= "偃无师" and 人物 ~= "鬼潇潇" and 人物 ~= "桃夭夭" then
      return true
    end
  elseif (坐骑 == "汗血宝马" or 坐骑 == "欢喜羊羊") and 种族 == "人" and 人物 ~= "偃无师" then
    return true
  elseif (坐骑 == "魔力斗兽" or 坐骑 == "披甲战狼") and 种族 == "魔" and 人物 ~= "鬼潇潇" then
    return true
  elseif (坐骑 == "闲云野鹤" or 坐骑 == "云魅仙鹿") and 种族 == "仙" and 人物 ~= "桃夭夭" then
    return true
  end
  return false
end

function 计算修炼等级经验(等级, 上限)
  if 等级 == 0 then
    return 110
  end
  local 临时经验 = 110
  for n = 1, 上限 + 1 do
    临时经验 = 临时经验 + 20 + n * 20
    if n == 等级 then
      return 临时经验
    end
  end
end

function 技能树(a)
  if a == 1 or a == 4 or a == 7 or a == 10 or a == 13 or a == 16 then
    return  a == 16 and  {a+3} or {a+3,a+4}
  elseif a == 2 or a == 5 or a == 8 or a == 11 or a == 14 or a == 17 then
    return  a == 17  and  {a+2,a+4} or {a+2,a+3,a+4}
  elseif a == 3 or a == 6 or a == 9 or a == 12 or a == 15 or a == 18 then
     return  a == 18  and  {a+3} or {a+2,a+3}
  end
end

function 取宠物经验(等级)
  a={}
  for i=1,180 do
    a[i]=50*i
  end
  return a[等级]
end

function 计算技能数据(目标技能等级)
 local 经验={[1]=16,[2]=32,[3]=52,[4]=75,[5]=103,[6]=136,[7]=179,[8]=231,[9]=295,[10]=372,[11]=466,[12]=578,[13]=711,[14]=867,[15]=1049,[16]=1280,[17]=1503,[18]=1780,[19]=2096,[20]=2452,[21]=2854,[22]=3304,[23]=3807,[24]=4364,
 [25]=4983,[26]=5664,[27]=6415,[28]=7238,[29]=8138,[30]=9120,[31]=10188,[32]=11347,[33]=12602,[34]=13959,[35]=15423,[36]=16998,[37]=18692,[38]=20508,[39]=22452,[40]=24532,[41]=26753,[42]=29121,[43]=31642,[44]=34323,
 [45]=37169,[46]=40186,[47]=43388,[48]=46773,[49]=50352,[50]=54132,[51]=58120,[52]=62324,[53]=66750,[54]=71407,[55]=76303,[56]=81444,[57]=86840,[58]=92500,[59]=104640,[60]=111136,[61]=117931,[62]=125031,[63]=132444,
 [64]=140183,[65]=148253,[66]=156666,[67]=156666,[68]=165430,[69]=174556,[70]=184052,[71]=193930,[72]=204198,[73]=214868,[74]=225948,[75]=237449,[76]=249383,[77]=261760,[78]=274589,[79]=287884,[80]=301652,[81]=315908,
 [82]=330662,[83]=345924,[84]=361708,[85]=378023,[86]=394882,[87]=412297,[88]=430280,[89]=448844,[90]=468000,[91]=487760,[92]=508137,[93]=529145,[94]=550796,[95]=573103,[96]=596078,[97]=619735,[98]=644088,[99]=669149,
 [100]=721452,[101]=748722,[102]=776755,[103]=805566,[104]=835169,[105]=865579,[106]=896809,[107]=928876,[108]=961792,[109]=995572,[110]=1030234,[111]=1065190,[112]=1102256,[113]=1139649,[114]=1177983,[115]=1217273,
 [116]=1256104,[117]=1298787,[118]=1341043,[119]=1384320,[120]=1428632,[121]=1473999,[122]=1520435,[123]=1567957,[124]=1616583,[125]=1666328,[126]=1717211,[127]=1769248,[128]=1822456,[129]=1876852,[130]=1932456,[131]=1989284,
 [132]=2047353,[133]=2106682,[134]=2167289,[135]=2229192,[136]=2292410,[137]=2356960,[138]=2422861,[139]=2490132,[140]=2558792,[141]=2628860,[142]=2700356,[143]=2773296,[144]=2847703,[145]=2923593,[146]=3000989,[147]=3079908,
 [148]=3160372,[149]=3242400,[150]=6652022,[151]=6822452,[152]=6996132,[153]=7173104,[154]=7353406,[155]=11305620,[156]=15305620,[157]=22305620,[158]=27305620,[159]=37305620,[160]=45305620,[161]=54305620,[162]=57305620,[163]=60305620,
 [164]=65305620,[165]=70305620,[166]=84305620,[167]=90103220,[168]=98430562,[169]=102436520,[170]=240146920,[171]=244383080,[172]=248668800,[173]=25300432,[174]=257390000,[175]=327282520,[176]=332890920,[177]=338563080,[178]=344299280,
 [179]=408420000,[180]=520984200,[181]=999999999999}
 local 金钱={[1]=6,[2]=12,[3]=19,[4]=28,[5]=38,[6]=51,[7]=67,[8]=86,[9]=110,[10]=139,[11]=174,[12]=216,[13]=266,[14]=325,[15]=393,[16]=472,[17]=563,[18]=667,[19]=786,[20]=919,[21]=1070,[22]=1238,[23]=1426,[24]=1636,[25]=1868,[26]=2124,
 [27]=2404,[28]=2714,[29]=3050,[30]=3420,[31]=3820,[32]=4255,[33]=4725,[34]=5234,[35]=5783,[36]=6374,[37]=7009,[38]=7680,[39]=8419,[40]=9199,[41]=10032,[42]=10920,[43]=11865,[44]=12871,[45]=13938,[46]=15070,[47]=16270,[48]=17540,[49]=18882,
 [50]=20299,[51]=21795,[52]=23371,[53]=25031,[54]=26777,[55]=28613,[56]=30541,[57]=32565,[58]=34687,[59]=36911,[60]=39240,[61]=41676,[62]=44224,[63]=46886,[64]=49666,[65]=52568,[66]=55595,[67]=58749,[68]=62036,[69]=65458,[70]=69019,[71]=72723,
 [72]=76574,[73]=80575,[74]=84730,[75]=89043,[76]=93516,[77]=98160,[78]=102971,[79]=107956,[80]=113119,[81]=118465,[82]=123998,[83]=129721,[84]=135640,[85]=141758,[86]=148080,[87]=154611,[88]=161355,[89]=168316,[90]=175500,[91]=182910,[92]=190551,
 [93]=198429,[94]=206548,[95]=214913,[96]=223529,[97]=232400,[98]=241533,[99]=250931,[100]=260599,[101]=270544,[102]=280770,[103]=291283,[104]=302087,[105]=313188,[106]=324592,[107]=336303,[108]=348328,[109]=360672,[110]=373339,[111]=386337,
 [112]=399671 ,[113]=413346,[114]=427368,[115]=441743,[116]=456477,[117]=471576,[118]=487045,[119]=502891,[120]=519120,[121]=535737,[122]=552749,[123]=570163,[124]=587984,[125]=606218,[126]=624873,[127]=643954,[128]=663468 ,[129]=683421,[130]=703819,
 [131]=724671,[132]=745981,[133]=767757,[134]=790005,[135]=812733,[136]=835947 ,[137]=859653,[138]=883860,[139]=908573 ,[140]=933799 ,[141]=959547 ,[142]=985822,[143]=1012633,[144]=1039986,[145]=1067888 ,[146]=1096347,[147]=1125371,[148]=1154965,
 [149]=1185139,[150]=1215900,[151]=2494508,[152]=2558419,[153]=2623549,[154]=2689914,[155]=2757527,[156]=4239607,[157]=6239607,[158]=8239607,[159]=10239607,[160]=15239607,[161]=18239607,[162]=20239607,[163]=25239607,[164]=30239607,[165]=36239607,
 [166]=40239607,[167]=46022396,[168]=50052309,[169]=53239607,[170]=72044070,[171]=73314900,[172]=74600640,[173]=75901290,[174]=77217001,[175]=98184750,[176]=99867270,[177]=101568930,[178]=103289790,[179]=122526000,[180]=168239607,[181]=999999999999}
  return {经验=经验[目标技能等级]*2,金钱=金钱[目标技能等级]*2}
end

function 取包含技能(名称)
  local 技能 = {
    为官之道 = {"杀气诀"},
    无双一击 = {"后发制人"},
    神兵鉴赏 = {"兵器谱"},
    疾风步 = {"千里神行"},
    十方无敌 =  {"横扫千军","破釜沉舟"},
    紫薇之术 = {"斩龙诀"},
    文韬武略 = {"反间之计","安神诀","嗜血"},
    黄庭经 = {"三星灭魔"},
    磐龙灭法 = {nil},
    霹雳咒 = {"五雷咒","落雷符","离魂符","失魂符","失心符","碎甲符"},
    符之术 = {"飞行符","兵解符","催眠符","落魄符","失忆符","追魂符","定身符"},
    归元心法 =  {"归元咒","凝神术"},
    神道无念 = {"乾天罡气","分身术","神兵护法"},
    斜月步 = {"乙木仙遁"},
    小乘佛法 = {"紫气东来"},
    金刚伏魔 = {"佛法无边"},
    诵经 = {"唧唧歪歪"},
    佛光普照 = {"达摩护体","金刚护法","韦陀护法","金刚护体","一苇渡江","拈花妙指"},
    大慈大悲 =  {"我佛慈悲"},
    歧黄之术 = {"推拿","活血","推气过宫","妙手回春","救死扶伤","解毒","舍生取义"},
    渡世步 = {"佛门普渡"},
    毒经 = {nil},
    倾国倾城 = {"红袖添香","楚楚可怜","一笑倾城"},
    沉鱼落雁 = {"满天花雨","情天恨海","雨落寒沙"},
    闭月羞花 = {"莲步轻舞","如花解语","似玉生香","娉婷嬝娜"},
    香飘兰麝 =  {"轻如鸿毛"},
    玉质冰肌 = {"百毒不侵"},
    清歌妙舞 = {"移形换影","飞花摘叶"},
    灵通术 = {"堪察令","寡欲令"},
    六道轮回 = {"魂飞魄散"},
    幽冥术 = {"阎罗令","锢魂术","黄泉之息"},
    拘魂诀 = {"判官令","还阳术","尸气漫天"},
    九幽阴魂 =  {"幽冥鬼眼","冤魂不散"},
    尸腐恶 = {"尸腐毒","修罗隐身"},
    无常步 = {"杳无音讯"},
    牛逼神功 = {"魔王护持"},
    震天诀 = {nil},
    火云术 = {"飞砂走石","三昧真火","火甲术"},
    火牛阵 = {"牛劲","踏山裂石"},
    牛虱阵 =  {"无敌牛虱","无敌牛妖","摇头摆尾"},
    回身击 = {"魔王回首"},
    裂石步 = {"牛屎遁"},
    魔兽神功 = {"变身","魔兽啸天"},
    生死搏 = {"象形","鹰击","狮搏","天魔解体"},
    训兽诀 = {"威慑"},
    阴阳二气诀 = {"定心术","魔息术"},
    狂兽诀 =  {"连环击","神力无穷"},
    大鹏展翅 = {"振翅千里"},
    魔兽反噬 = {"极度疯狂"},
    蛛丝阵法 = {"盘丝舞","夺命蛛丝"},
    迷情大法 = {"含情脉脉","瘴气","魔音摄魂"},
    秋波暗送 = {"勾魂","摄魄"},
    天外魔音 = {nil},
    盘丝大法 =  {"盘丝阵","复苏"},
    盘丝步 = {"天罗地网","天蚕丝","幻镜术"},
    姊妹相随 = {"姐妹同心"},
    天罡气 = {"天神护体","天神护法","天诛地灭","五雷轰顶","雷霆万钧","浩然正气"},
    傲世诀 = {"天雷斩"},
    清明自在 = {"知己知彼"},
    宁气诀 =  {"宁心"},
    乾坤塔 = {"镇妖","错乱"},
    混天术 = {"百万神兵","金刚镯"},
    云霄步 = {"腾云驾雾"},
    九龙诀 = {"解封","清心","二龙戏珠"},
    破浪诀 = {"神龙摆尾"},
    呼风唤雨 = {"龙卷雨击"},
    龙腾术 =  {"龙腾"},
    逆鳞术 = {"逆鳞"},
    游龙术 = {"乘风破浪","水遁"},
    龙附术 = {"龙吟","龙啸九天","龙附"},
    灵性 = {"自在心法"},
    护法金刚 = {nil},
    观音咒 = {"紧箍咒","杨柳甘露"},
    五行学说 =  {"日光华","靛沧海","巨岩破","苍茫树","地裂火"},
    金刚经 = {"普渡众生","灵动九天","莲华妙法"},
    五行扭转 = {"五行错位","颠倒五行"},
    莲花宝座 = {"坐莲"},
    周易学 = {"驱魔","驱尸"},
    潇湘仙雨= {"烟雨剑法","飘渺式"},
    乾坤袖= {"日月乾坤","天地同寿","乾坤妙法"},
    修仙术=  {"炼气化神","生命之泉","太极生化","一气化三清"},
    混元道果 = {nil},
    明性修身 = {"三花聚顶"},
    七星遁 = {"斗转星移"},
    瞬息万变 = {"落叶萧萧"},
    万灵诸念= {"荆棘舞","尘土刃","冰川怒"},
    巫咒 = {"雾杀","血雨"},
    万物轮转 =  {"星月之惠"},
    天人庇护 = {"炎护","叶隐"},
    神木恩泽 = {"神木呓语"},
    驭灵咒 = {"蜜润","蝼蚁蚀天"},
    天地无极 = {nil},
    九转玄功 = {"不动如山"},
    武神显圣 = {"碎星诀","镇魂诀"},
    啸傲 = {nil},
    气吞山河 = {"裂石","断岳势","天崩地裂","浪涌","惊涛怒","翻江搅海"},
    诛魔 = {"腾雷","指地成钢"},
    法天象地 = {"无穷妙道","纵地金光"},
    枯骨心法 = {"移魂化骨"},
    阴风绝章 = {"夺魄令","煞气诀","惊魂掌","摧心术"},
    鬼蛊灵蕴 = {"夺命咒"},
    燃灯灵宝 = {"明光宝烛","金身舍利"},
    地冥妙法 = {"地涌金莲","万木凋枯"},
    混元神功 = {"元阳护体"},
    秘影迷踪 = {"遁地术"},
    天火献誓 = {nil},
    天罚之焰 = {"炽火流离","极天炼焰"},
    煌火无明 = {"谜毒之缚","诡蝠之刑","怨怖之泣","誓血之祭"},
    化神以灵 = {"唤灵·魂火","唤魔·堕羽","唤魔·毒魅","唤灵·焚魂","天魔觉醒"},
    弹指成烬 = {"净世煌火","焚魔烈焰"},
    藻光灵狱 = {"幽影灵魄"},
    离魂 = {"魂兮归来"},
    神工无形 = {"一发而动"},
    攻玉以石 = {"针锋相对","攻守易位"},
    擎天之械 = {"锋芒毕露"},
    千机奇巧 = {"诱袭","破击"},
    匠心不移 = {"匠心·削铁","匠心·固甲","匠心·蓄锐"},
    运思如电 = {"天马行空"},
    探奥索隐 = {"鬼斧神工","移山填海"},
    神通广大 = {"威震凌霄","气慑天军"},
    如意金箍 = {"当头一棒","神针撼海","杀威铁棒","泼天乱棒"},
    齐天逞胜 = {"九幽除名","移星换斗","云暗天昏"},
    金刚之躯 = {"担山赶月","铜头铁臂"},
    灵猴九窍 = {"无所遁形","天地洞明","除光息焰"},
    七十二变 = {"呼子唤孙","八戒上身"},
    滕云驾雾 = {"筋斗云"}
  }
  return 技能[名称]
end

function 取门派技能(门派)
  local n = {}
  if 门派 == "大唐官府" then
    return {"为官之道","无双一击","神兵鉴赏","疾风步","十方无敌","紫薇之术","文韬武略"}
  elseif 门派 == "方寸山" then
    return {"黄庭经","磐龙灭法","霹雳咒","符之术","归元心法","神道无念","斜月步"}
  elseif 门派 == "化生寺" then
    return {"小乘佛法","金刚伏魔","诵经","佛光普照","大慈大悲","歧黄之术","渡世步"}
  elseif 门派 == "女儿村" then
    return {"毒经","倾国倾城","沉鱼落雁","闭月羞花","香飘兰麝","玉质冰肌","清歌妙舞"}
  elseif 门派 == "阴曹地府" then
    return {"灵通术","六道轮回","幽冥术","拘魂诀","九幽阴魂","尸腐恶","无常步"}
  elseif 门派 == "魔王寨" then
    return {"牛逼神功","震天诀","火云术","火牛阵","牛虱阵","回身击","裂石步"}
  elseif 门派 == "狮驼岭" then
    return {"魔兽神功","生死搏","训兽诀","阴阳二气诀","狂兽诀","大鹏展翅","魔兽反噬"}
  elseif 门派 == "盘丝洞" then
    return {"蛛丝阵法","迷情大法","秋波暗送","天外魔音","盘丝大法","盘丝步","姊妹相随"}
  elseif 门派 == "天宫" then
    return {"天罡气","傲世诀","清明自在","宁气诀","乾坤塔","混天术","云霄步"}
  elseif 门派 == "五庄观" then
    return {"周易学","潇湘仙雨","乾坤袖","修仙术","混元道果","明性修身","七星遁"}
  elseif 门派 == "龙宫" then
    return {"九龙诀","破浪诀","呼风唤雨","龙腾术","逆鳞术","游龙术","龙附术"}
  elseif 门派 == "普陀山" then
    return {"灵性","护法金刚","观音咒","五行学说","金刚经","五行扭转","莲花宝座"}
  elseif 门派 == "神木林" then
    return {"瞬息万变","万灵诸念","巫咒","万物轮转","天人庇护","神木恩泽","驭灵咒"}
  elseif 门派 == "凌波城" then
    return {"天地无极","九转玄功","武神显圣","啸傲","气吞山河","诛魔","法天象地"}
  elseif 门派 == "无底洞" then
    return  {"枯骨心法","阴风绝章","鬼蛊灵蕴","燃灯灵宝","地冥妙法","混元神功","秘影迷踪"}
  elseif 门派 == "女魃墓" then
    return  {"天火献誓","天罚之焰","煌火无明","化神以灵","弹指成烬","藻光灵狱","离魂"}
   elseif 门派 == "天机城" then
    return  {"神工无形","攻玉以石","擎天之械","千机奇巧","匠心不移","运思如电","探奥索隐"}
    elseif 门派 == "花果山" then
    return  {"神通广大","如意金箍","齐天逞胜","金刚之躯","灵猴九窍","七十二变","滕云驾雾"}

  end
end

function 发送网关消息(msg)
   __S服务:发送(连接id,991,1,msg)
end

function 加载角色数据(data)
  if type(data.名称)~="string" then
    data.名称="名字"..data.id
  end
    if string.len(data.名称)>15 or data.名称=="" then
    data.名称="名字"..data.id
    elseif string.find(data.名称,[[\]])~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,[[/]])~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,[[@]])~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,[[#]])~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,[[*]])~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,[[ ]])~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,"老G")~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,"老g")~=nil  then
    data.名称="名字"..data.id
    elseif string.find(data.名称,"炸服")~=nil  then
    data.名称="名字"..data.id
    end

  for n=#data.任务数据, 1 ,-1 do
    if 任务数据[data.任务数据[n]] == nil then
        table.remove(data.任务数据,n)
    elseif 任务数据[data.任务数据[n]].类型 == "门派闯关" and 门派闯关开关 == false then
        任务数据[data.任务数据[n]] = nil
        table.remove(data.任务数据,n)
    elseif (任务数据[data.任务数据[n]].类型 == "变身卡" or 任务数据[data.任务数据[n]].类型 == "双倍") and os.time() - 任务数据[data.任务数据[n]].起始 >= 任务数据[data.任务数据[n]].结束 then
       if 任务数据[data.任务数据[n]].类型 == "变身卡" then
          data.变身={造型=nil,技能=nil,属性={数值=0,类型=0,属性=""}}
       elseif 任务数据[data.任务数据[n]].类型 == "双倍" then
          data.双倍 =false
       end
          任务数据[data.任务数据[n]] = nil
          table.remove(data.任务数据,n)
    elseif 任务数据[data.任务数据[n]].类型 =="抓鬼" or 任务数据[data.任务数据[n]].类型 =="除暴安良"  or 任务数据[data.任务数据[n]].类型 == "摇钱树"or 任务数据[data.任务数据[n]].类型 == "梦幻瓜子"or 任务数据[data.任务数据[n]].类型 == "锦衣碎片" or 任务数据[data.任务数据[n]].类型 == "强化珠"then
          任务数据[data.任务数据[n]] = nil
          table.remove(data.任务数据,n)
    end
  end
 for n=21,26 do
   if data.装备数据[n]~=nil or data.装备数据[n]==0  then
      for i=1,160 do
        if data.道具.包裹[i]==data.装备数据[n] then
        data.道具.包裹[i]=nil
        end
      end
      for i=1,160 do
        if data.道具.行囊[i]==data.装备数据[n] then
        data.道具.行囊[i]=nil
        end
      end
      for i=1,160 do
        if data.道具.法宝[i]==data.装备数据[n] then
        data.道具.法宝[i]=nil
        end
      end
      for i=1,160 do
        if data.道具.锦衣[i]==data.装备数据[n] then
        data.道具.锦衣[i]=nil
        end
      end
    end
  end
 for n=1,160 do
   if data.道具.行囊[n]~=nil or data.道具.行囊[n]==0 or data.道具.法宝[n]==0 or data.道具.锦衣[n]==0 then
     for i=1,160 do

        if data.道具.行囊[i]==data.道具.行囊[n] and i~=n then

           data.道具.行囊[i]=nil
          end
       end
     end
   end
 for n=1,160 do
   if data.道具.包裹[n]~=nil or data.道具.行囊[n]==0 or data.道具.法宝[n]==0 or data.道具.锦衣[n]==0 then
     for i=1,160 do
        if data.道具.包裹[i]==data.道具.包裹[n] and i~=n then

           data.道具.包裹[i]=nil
          end
       end
     end
      if data.道具.法宝[n]~=nil or data.道具.行囊[n]==0 or data.道具.包裹[n]==0  or data.道具.锦衣[n]==0 then
        for i=1,160 do
          if data.道具.法宝[i]==data.道具.法宝[n] and i~=n then
          data.道具.法宝[i]=nil
          end
        end
      end
      if data.道具.锦衣[n]~=nil or data.道具.行囊[n]==0 or data.道具.包裹[n]==0  or data.道具.法宝[n]==0 then
        for i=1,160 do
          if data.道具.锦衣[i]==data.道具.锦衣[n] and i~=n then
          data.道具.锦衣[i]=nil
          end
        end
      end
   end
  if data.传送地图 == nil then
     data.传送地图 = 1501
  end
  if data.保护期 == nil then
    data.保护期 = 0
  end

  for n=1,#全局变量.修炼名称 do
    if data.等级 <=69 and data.人物修炼[全局变量.修炼名称[n]].上限>9 then
        data.人物修炼[全局变量.修炼名称[n]].上限 =9
     elseif    data.等级 <=89 and data.人物修炼[全局变量.修炼名称[n]].上限>13 then
              data.人物修炼[全局变量.修炼名称[n]].上限 =13
     elseif    data.等级 <=109 and data.人物修炼[全局变量.修炼名称[n]].上限>17 then
              data.人物修炼[全局变量.修炼名称[n]].上限 =17
     elseif    data.等级 >109 and not data.飞升 and data.人物修炼[全局变量.修炼名称[n]].上限>20 then
              data.人物修炼[全局变量.修炼名称[n]].上限 =20
     end
     if  data.人物修炼[全局变量.修炼名称[n]].等级> data.人物修炼[全局变量.修炼名称[n]].上限 then
      data.人物修炼[全局变量.修炼名称[n]].等级= data.人物修炼[全局变量.修炼名称[n]].上限
     end
  end

  if  data.灵饰[35] ==nil  then
     data.灵饰[35] =0
  end
  if  data.灵饰[36] ==nil  then
     data.灵饰[36] =0
  end
  if data.pk保护 == nil then
    data.pk开关 = false
    data.pk时间 = 0
    data.pk保护 = 0
  end
if data.洗炼次数 ==nil  then
 data.洗炼次数 = 0
 end
 if data.道具.Pages == nil  then
    data.道具.Pages =1
 end
 if data.头像 ==nil  then
          data.头像="未拥有"
       end
     if data.彩饰 ==nil  then
          data.彩饰="未拥有"
       end
     if data.头像时间 ==nil  then
          data.头像时间=0
       end
     if data.彩饰时间 ==nil  then
          data.彩饰时间 =0
       end

     if data.头像时间 - os.time() <= 0  then
           data.头像="未拥有"
       end
     if data.彩饰时间 - os.time() <= 0  then
           data.彩饰="未拥有"
       end
   ----新加数据
       if data.成就积分 ==nil  then
         data.成就积分=0
       end
        if data.新年积分 ==nil  then
         data.新年积分=0
       end
         if data.长安保卫战积分 ==nil  then
         data.长安保卫战积分=0
       end
       if data.长安保卫战累计积分 ==nil  then
         data.长安保卫战累计积分=0
       end
    if data.法宝灵气 ==nil  then
      data.法宝灵气=0
      data.地煞积分=0
      data.知了积分=0
      data.天罡积分=0
      data.单人积分=0
      data.成就积分=0
      data.特殊积分=0

    end
    if data.守护积分 ==nil  then
     data.守护积分=0
     end
   if data.中等抽奖 ==nil  then
         data.中等抽奖=0
       end
   if data.大雁塔清空==nil then
     data.大雁塔=0
     data.大雁塔清空=1
   end
   if data.累冲积分 ==nil  then
         data.累冲积分=0
       end

     if data.累冲30 ==nil  then
          data.累冲30=0
       end
     if data.累冲500 ==nil  then
          data.累冲500=0
       end
     if data.累冲1000 ==nil  then
          data.累冲1000=0
       end
     if data.累冲1800 ==nil  then
          data.累冲1800=0
       end
     if data.累冲3000 ==nil  then
          data.累冲3000=0
       end
     if data.累冲5000 ==nil  then
          data.累冲5000=0
       end
     if data.累冲10000 ==nil  then
          data.累冲10000=0
       end
     if data.累冲20000 ==nil  then
          data.累冲20000=0
       end

   if data.威望经验 ==nil  then
          data.威望经验=0
       end
   if data.锁定格子 ==nil  then
         data.锁定格子 = {}
     for i = 1,80 do
           data.锁定格子[i]= 0
     end
       end
      if data.锁定附魔 ==nil  then
         data.锁定附魔 = {}
     for i = 1,16 do
           data.锁定附魔[i]= false
     end
       end
       -------
   if data.镇魔声望 ==nil  then
          data.镇魔声望={累计 =0,当前 =0}
       end
        if data.累计镇魔 ==nil  then
           data.累计镇魔= {当前 =0,耗时 =86400,名称= data.名称}
       end
      if data.连续镇魔 ==nil  then
           data.连续镇魔= 0
       end
     if data.额外镇魔 ==nil  then
           data.额外镇魔 = 0
       end
   if data.知了积分清空==nil then
     data.知了积分=0
     data.知了积分清空=1
   end

    if data.知了积分清空 and data.知了积分清空<=2 then
     data.知了积分=0
     data.知了积分清空=3
   end

--  if data.大雁塔清空 and data.大雁塔清空<=1 then
   --   data.大雁塔=0
   --   data.大雁塔清空=2
   -- end

    if data.变身技能 ==nil then
     data.变身技能={}
   end
  if data.召唤兽修炼点数==nil then
     data.召唤兽修炼点数 =0
  end
  local 临时参考 = data.等级 * 5 + 10+data.辅助技能[7].等级*4
  if not data.子女列表.参战 then
        data.子女列表.参战 =0
  end
  if data.体力上限 ~= 临时参考 then
    data.体力上限 = 临时参考
  end
  临时参考 = data.等级 * 5 + 10+data.辅助技能[8].等级*4
  if data.活力上限 ~= 临时参考 then
    data.活力上限 = 临时参考
  end
  if data.名称 ~="游戏管理员" then
    local 属性 = {"最大气血","防御","伤害","速度","命中","灵力","魔法上限","躲闪"}
    local 排行属性 ={"气血排行","防御排行","伤害排行","速度排行","命中排行","灵力排行","魔法排行","躲避排行"}
     for o=1,8 do
       for i=1,20 do
        if data.名称 == Ranking.属性排行[排行属性[o]][i].名称 then
             Ranking.属性排行[排行属性[o]][i].数值=data[属性[o]]
           break
        elseif data[属性[o]] > Ranking.属性排行[排行属性[o]][i].数值 then
            table.remove(Ranking.属性排行[排行属性[o]],20)
            table.insert(Ranking.属性排行[排行属性[o]],{名称=data.名称,数值=data[属性[o]]})
            break
        end
     end
       删除重复组(Ranking.属性排行[排行属性[o]])
      table.sort(Ranking.属性排行[排行属性[o]],function(a,b) return a.数值>b.数值 end )
   end
    local 属性 = {"门贡","知了积分","长安保卫战累计积分","活动积分","比武积分","副本积分","成就积分","单人积分"}
    local 排行属性 ={"门贡排行","知了积分","长安保卫","活动积分","比武积分","副本积分","成就积分","单人积分"}
     for o=1,8 do
       for i=1,20 do
        if data.名称 == Ranking.积分排行[排行属性[o]][i].名称 then
          Ranking.积分排行[排行属性[o]][i].数值=data[属性[o]]

           break
        elseif data[属性[o]] > Ranking.积分排行[排行属性[o]][i].数值 then
            table.remove(Ranking.积分排行[排行属性[o]],20)
            table.insert(Ranking.积分排行[排行属性[o]],{名称=data.名称,数值=data[属性[o]]})

            break
        end
     end
      删除重复组(Ranking.积分排行[排行属性[o]])
      table.sort(Ranking.积分排行[排行属性[o]],function(a,b) return a.数值>b.数值 end )
   end
    local 属性 = {"银子","储备","获得经验","当前经验","仙玉","累计充值","获得银子","等级"}
    local 排行属性 ={"银子排行","储备排行","积累经验","经验排行","仙玉排行","累冲排行","积累银子","人物等级"}
     for o=1,8 do
       for i=1,20 do
        if data.名称 == Ranking.数据排行[排行属性[o]][i].名称 then
              if o==1  then
                  Ranking.数据排行[排行属性[o]][i].数值=data.道具.货币[属性[o]]+data.道具.货币.存银
              elseif o==2 then
                Ranking.数据排行[排行属性[o]][i].数值=data.道具.货币[属性[o]]
              elseif o==5 then
                 local 临时仙玉=  f函数.读配置(ServerDirectory.."玩家信息/账号" .. data.账号 .. "/账号.txt", "账号信息", "仙玉") + 0
                  Ranking.数据排行[排行属性[o]][i].数值=临时仙玉
              elseif  o==6 then
                 Ranking.数据排行[排行属性[o]][i].数值=data.vip.充值
              elseif data[属性[o]] > Ranking.数据排行[排行属性[o]][i].数值 then
                  Ranking.数据排行[排行属性[o]][i].数值=data[属性[o]]

               elseif  o==7 then
                 Ranking.数据排行[排行属性[o]][i].数值=data.累计镇魔.当前
              elseif data[属性[o]] > Ranking.数据排行[排行属性[o]][i].数值 then
                  Ranking.数据排行[排行属性[o]][i].数值=data[属性[o]]
               end
           break
        elseif o==1  then
           if  data.道具.货币[属性[o]]+data.道具.货币.存银 > Ranking.数据排行[排行属性[o]][i].数值 then
            table.remove(Ranking.数据排行[排行属性[o]],20)
            table.insert(Ranking.数据排行[排行属性[o]],{名称=data.名称,数值=data.道具.货币[属性[o]]+data.道具.货币.存银})

            break
          end
        elseif o==2  then
          if  data.道具.货币[属性[o]] > Ranking.数据排行[排行属性[o]][i].数值 then
            table.remove(Ranking.数据排行[排行属性[o]],20)
            table.insert(Ranking.数据排行[排行属性[o]],{名称=data.名称,数值=data.道具.货币[属性[o]]})
            break
          end
        elseif o==5 then
           local 临时仙玉=  f函数.读配置(ServerDirectory.."玩家信息/账号" .. data.账号 .. "/账号.txt", "账号信息", "仙玉") + 0
           if  临时仙玉 > Ranking.数据排行[排行属性[o]][i].数值 then
            table.remove(Ranking.数据排行[排行属性[o]],20)
            table.insert(Ranking.数据排行[排行属性[o]],{名称=data.名称,数值=临时仙玉})

            break
          end
        elseif o==6 then

           if  data.vip.充值 > Ranking.数据排行[排行属性[o]][i].数值 then
            table.remove(Ranking.数据排行[排行属性[o]],20)
            table.insert(Ranking.数据排行[排行属性[o]],{名称=data.名称,数值=data.vip.充值})

            break
          end
          elseif o==7 then

           if  data.累计镇魔.当前 > Ranking.数据排行[排行属性[o]][i].数值 then
            table.remove(Ranking.数据排行[排行属性[o]],20)
            table.insert(Ranking.数据排行[排行属性[o]],{名称=data.名称,数值=data.累计镇魔.当前})

            break
          end
        elseif data[属性[o]] > Ranking.数据排行[排行属性[o]][i].数值 then
            table.remove(Ranking.数据排行[排行属性[o]],20)
            table.insert(Ranking.数据排行[排行属性[o]],{名称=data.名称,数值=data[属性[o]]})

            break
          end
      end
      删除重复组(Ranking.数据排行[排行属性[o]])
      table.sort(Ranking.数据排行[排行属性[o]],function(a,b) return a.数值>b.数值 end )
   end
  end
    return data
end
function 加载战令数据(q)
   local data = table.loadstring(q)
     return data
 end
  function 加载图鉴数据(q)
    local data = table.loadstring(q)
    return data
 end
function 加载item数据(q)----------------------------------完成--
  local data = table.loadstring(q)
  if not data then
    data={}
  end
  for n, v in pairs(data) do
    if v == 0 then
      data[n] = nil
    elseif not v.名称  then
       data[n] = nil
    elseif v.名称=="灵饰缘石" or v.名称=="60级灵饰礼包" or v.名称=="80级灵饰礼包"or v.名称=="100级灵饰礼包"or v.名称=="120级灵饰礼包"or v.名称=="140级灵饰礼包"
      or v.名称=="160级灵饰礼包" or v.名称=="初心宝珠" or v.名称=="月饼-中" or v.名称=="月饼-秋"or v.名称=="月饼-节"or v.名称=="月饼-快"or v.名称=="月饼-乐"or v.名称=="月饼"or v.名称=="宠物礼包" or v.名称=="150无级别礼包" or v.名称=="150抽奖礼包" then
        data[n] = nil
    elseif v.Time and v.Time <= os.time() then
      data[n] = nil
    end
  end
  return data
end

function 管理消息(参数,内容)
  发送数据(id, 990, 内容)
  发送数据(玩家数据[参数].连接id, 7, "#Y/"..内容)
  发送数据(玩家数据[参数].连接id, 9, "#xt/"..内容)
end

function 取目录下名称(path,lx)
 local directory,file={},{}
    for n in lfs.dir(path) do   --  lfs.dir  根据路径获取该路径下的文件名
        if n ~= '.' and n ~= '..' then
            local f = (path .. '/'..n)
            local attr = lfs.attributes(f) -- 该文件的各种属性
            if attr.mode == "directory" then
                table.insert(directory,n)
                 --取目录下名称(f)
             elseif attr.mode=="file" then
                table.insert(file,n)
            end
        end
    end
    return lx and file or directory
end

function TimeUpdate()
    if 游戏时辰.刷新 <= os.time() - 游戏时辰.起始 then
        游戏时辰.起始 = os.time()
        游戏时辰.当前 = 游戏时辰.当前 + 1
        if 游戏时辰.当前 ~= 5 and 游戏时辰.当前 == 10 then
            -- Nothing
        end
        if 游戏时辰.当前 == 13 then
            游戏时辰.当前 = 1
            if 昼夜参数 == 0 then
                昼夜参数 = 1
                广播消息(9, "#xt/#w/天黑了")
            else
                昼夜参数 = 0
                广播消息(9, "#xt/#w/天亮了")
            end
        end
        for n, v in pairs(玩家数据) do
            if 玩家数据[n]  then
                发送数据(玩家数据[n].连接id, 11, 游戏时辰.当前)
                发送数据(玩家数据[n].连接id, 17, 昼夜参数)
            end
        end
    end
end

function 取表数量(t)
    local n=0
    for k,v in pairs(t) do
        n=n+1
    end
    return n
end

function 取随机染色()
  local 染色 = {
  [1]={119,0,0},
  [2]={119,1,0},
  [3]={119,2,0},
  [4]={2000,1,0},
  [5]={2000,2,0},
  [6]={2000,3,0},
  [7]={2010,1,0},
  [8]={2010,2,0},
  [9]={2010,4,0},
  [10] ={2010,5,0},
  [11] ={2010,6,0},
  [12] ={20113,1,0},
  [13] ={20113,3,0},
  [14] ={20113,4,0},
  [15] ={20113,5,0},
  [16] ={20113,6,0},
  [17] ={2042,1,0},
  [18] ={2077,1,0},
  [19] ={2077,2,0},
  [20] ={2077,3,0},
  [21] ={2078,1,0},
  [22] ={2078,2,0},
  [23] ={2078,4,0},
  [24] ={2078,5,0},
  [25] ={2078,6,0},
  [26] ={2079,1,0},
  [27] ={2079,2,0},
  [28] ={2079,4,0},
  [29] ={2079,5,0},
  [30] ={2079,6,0},
  [31] ={23,1,0},
  [32] ={23,2,0},
  [33] ={23,3,0},
  [34] ={24,1,0},
  [35] ={24,2,0},
  [36] ={24,3,0},
  [37] ={31,1,0},
  [38] ={31,2,0},
  [39] ={31,3,0},
  [40] ={32,1,0},
  [41] ={32,2,0},
  [42] ={32,3,0},
  [43] ={33,1,0},
  [44] ={33,2,0},
  [45] ={33,3,0},
  [46] ={39,1,0},
  [47] ={39,2,0},
  [48] ={39,3,0},
  [49] ={40,1,0},
  [50] ={40,2,0},
  [51] ={40,3,0},
  [52] ={44,1,0},
  [53] ={44,2,0},
  [54] ={44,3,0},
  [55] ={45,1,0},
  [56] ={45,2,0},
  [57] ={45,3,0},
  [58] ={47,1,0},
  [59] ={47,2,0},
  [60] ={47,3,0},
  [61] ={48,1,0},
  [62] ={48,2,0},
  [63] ={48,3,0},
  [64] ={49,1,0},
  [65] ={49,2,0},
  [66] ={49,3,0},
  [67] ={52,1,0},
  [68] ={62,1,0},
  [69] ={64,1,0},
  [70] ={66,1,0},
  [71] ={67,1,0},
  [72] ={68,1,0},
  [73] ={72,1,0},
  [74] ={73,1,0},
  [75] ={76,1,0},
  [76] ={77,1,0},
  [77] ={78,1,0},
  [78] ={88,1,0},
  [79] ={95,1,0},
  [80] ={96,1,0},
  [81] ={97,1,0},}
   return  染色[math.random(1,#染色)]
end
function 扣除抽卡劵(id)

       for n = 1,160 do
      if 玩家数据[id].角色.道具["包裹"][n] ~= nil and 玩家数据[id].物品[玩家数据[id].角色.道具["包裹"][n]].名称 == "抽卡劵" then
         发送数据(玩家数据[id].连接id, 7, "#G/扣除#R/抽卡卷*1")
        道具处理类:RemoveItems(玩家数据[id],n,"抽卡劵",1)
      return true
      end
    end
    发送数据(玩家数据[id].连接id, 7, "#G/您身上没有#R/抽卡卷#G/，请咨询客服")
    return false
end

function 封禁账号(user,内容)
      f函数.写配置(ServerDirectory.."玩家信息/账号" .. user.账号 .. "/账号.txt", "账号信息", "封禁", 内容)
      发送数据(user.连接id,99998,"您的账号已经被封禁")
    广播消息(9, "#xt/#g/ " .. user.角色.名称 .. "使用非法软件,已经封号,封禁原因为:"..内容)
    网络处理类:退出处理(user.id, 内容)
end

function 取地煞门派(角色)
  local 门派 ="大唐官府"
  if 角色 == "剑侠客"then
    门派 ="大唐官府"
  elseif 角色 == "巨魔王"then
  门派 ="狮驼岭"
  elseif 角色 == "神天兵"then
  门派 ="天宫"
  elseif 角色 == "逍遥生"then
  门派 ="化生寺"
  elseif 角色 == "虎头怪"then
  门派 ="魔王寨"
  elseif 角色 == "龙太子"then
  门派 ="龙宫"
  elseif 角色 == "玄彩娥"then
  门派 ="普陀山"
  elseif 角色 == "巫蛮儿"then
  门派 ="神木林"
  elseif 角色 == "飞燕女"then
  门派 ="女儿村"
  elseif 角色 == "偃无师"then
  门派 ="大唐官府"
  elseif 角色 == "英女侠"then
  门派 ="方寸山"
  elseif 角色 == "狐美人"then
  门派 ="盘丝洞"
  elseif 角色 == "骨精灵"then
  门派 ="阴曹地府"
  elseif 角色 == "杀破狼"then
  门派 ="无底洞"
  elseif 角色 == "鬼潇潇"then
  门派 ="无底洞"
  elseif 角色 == "羽灵神"then
  门派 ="凌波城"
  elseif 角色 == "桃夭夭"then
  门派 ="天宫"
  elseif 角色 == "舞天姬"then
  门派 ="天宫"
  end
  return 门派
end

function 取假人模型(门派)
  local 角色 ={}
  if 门派 == "神木林" or 门派 == "方寸山" or 门派 == "大唐官府"  then
    角色 ={"飞燕女", "英女侠","巫蛮儿","逍遥生","剑侠客","偃无师"}
  elseif 门派 == "女儿村" then
    角色 ={"飞燕女", "英女侠","巫蛮儿"}
  elseif 门派 == "化生寺" then
    角色 ={"逍遥生","剑侠客","偃无师"}
  elseif 门派 == "阴曹地府" or 门派 == "魔王寨" or 门派 == "无底洞"  then
    角色 ={"狐美人","骨精灵" ,"杀破狼","巨魔王","虎头怪","鬼潇潇"}
  elseif 门派 == "盘丝洞" then
    角色 ={"狐美人","骨精灵","鬼潇潇"}
  elseif 门派 == "狮驼岭" then
    角色 ={"杀破狼","巨魔王","虎头怪"}
  elseif 门派 =="天宫"or 门派 == "龙宫" or 门派 == "凌波城" then
    角色 ={"舞天姬","玄彩娥","羽灵神","神天兵","龙太子","桃夭夭"}
  elseif 门派 == "普陀山" then
    角色 ={"舞天姬","玄彩娥","桃夭夭"}
  elseif 门派 == "五庄观" then
    角色 ={"羽灵神","神天兵","龙太子"}
  elseif 门派 == "花果山" then
    角色 ={"舞天姬","玄彩娥","羽灵神","神天兵","龙太子","桃夭夭"}
  elseif 门派 == "天机城" then
    角色 ={"飞燕女", "英女侠","巫蛮儿","逍遥生","剑侠客","偃无师"}
  elseif 门派 == "女魃墓" then
    角色 ={"狐美人","骨精灵" ,"杀破狼","巨魔王","虎头怪","鬼潇潇"}
 end
 return 角色[math.random(1,#角色)]
end

function 取假人武器(角色,等级)
 local 武器 ={
  龙太子={
  [70]={类别="枪" ,等级=70,名称="玄铁矛"},
  [80]={类别="枪" ,等级=80,名称="玄铁矛"},
  [90]={类别="枪" ,等级=90,名称="暗夜"},
  [100]={类别="枪" ,等级=100,名称="梨花"},
  [110]={类别="枪" ,等级=110,名称="霹雳"},
  [120]={类别="枪" ,等级=120,名称="五虎断魂"},
  [130]={类别="枪" ,等级=130,名称="飞龙在天"},
  [140]={类别="枪" ,等级=140,名称="刑天之逆"},
  [150]={类别="枪" ,等级=150,名称="天龙破城"},
  [160]={类别="枪" ,等级=160,名称="弑皇"},
  },
 虎头怪={
  [70]={类别= "锤" ,等级=70,名称="震天锤"},
  [80]={类别= "锤" ,等级=80,名称="震天锤"},
  [90]={类别= "锤" ,等级=90,名称="八卦"},
  [100]={类别= "锤" ,等级=100,名称="鬼牙"},
  [110]={类别= "锤" ,等级=110,名称="雷神"},
  [120]={类别= "锤" ,等级=120,名称="鬼王蚀日"},
  [130]={类别= "锤" ,等级=130,名称="混元金锤"},
  [140]={类别= "锤" ,等级=140,名称="九瓣莲花"},
  [150]={类别= "锤" ,等级=150,名称="狂澜碎岳"},
  [160]={类别= "锤" ,等级=160,名称="碎寂"},
  },
  剑侠客={
  [70]={类别= "剑" ,等级=70,名称="游龙剑"},
  [80]={类别= "剑" ,等级=80,名称="游龙剑"},
  [90]={类别= "剑" ,等级=90,名称="鱼肠"},
  [100]={类别= "剑" ,等级=100,名称="倚天"},
  [110]={类别= "剑" ,等级=110,名称="湛卢"},
  [120]={类别= "剑" ,等级=120,名称="魏武青虹"},
  [130]={类别= "剑" ,等级=130,名称="四法青云"},
  [140]={类别= "剑" ,等级=140,名称="灵犀神剑"},
  [150]={类别= "剑" ,等级=150,名称="霜冷九州"},
  [160]={类别= "剑" ,等级=160,名称="擒龙"},
  },
  神天兵={
  [70]={类别="锤",等级=70,名称="震天锤"},
  [80]={类别="锤",等级=80,名称="震天锤"},
  [90]={类别="锤",等级=90,名称="八卦"},
  [100]={类别="锤",等级=100,名称="鬼牙"},
  [110]={类别="锤",等级=110,名称="雷神"},
  [120]={类别="锤",等级=120,名称="鬼王蚀日"},
  [130]={类别="锤",等级=130,名称="混元金锤"},
  [140]={类别="锤",等级=140,名称="九瓣莲花"},
  [150]={类别="锤",等级=150,名称="狂澜碎岳"},
  [160]={类别="锤",等级=160,名称="碎寂"}},
    巨魔王={
      [70]={类别="斧",等级=70,名称="乌金鬼头镰"},
      [80]={类别="斧",等级=80,名称="乌金鬼头镰"},
      [90]={类别="斧",等级=90,名称="破魄"},
      [100]={类别="斧",等级=100,名称="肃魂"},
      [110]={类别="斧",等级=110,名称="无敌"},
      [120]={类别="斧",等级=120,名称="护法灭魔"},
      [130]={类别="斧",等级=130,名称="五丁开山"},
      [140]={类别="斧",等级=140,名称="元神禁锢"},
      [150]={类别="斧",等级=150,名称="碧血干戚"},
      [160]={类别="斧",等级=160,名称="裂天"}},
    逍遥生={
      [70]={类别="扇",等级=70,名称="神火扇"},
      [80]={类别="扇",等级=80,名称="神火扇"},
      [90]={类别="扇",等级=90,名称="玉龙"},
      [100]={类别="扇",等级=100,名称="秋风"},
      [110]={类别="扇",等级=110,名称="太极"},
      [120]={类别="扇",等级=120,名称="画龙点睛"},
      [130]={类别="扇",等级=130,名称="逍遥江湖"},
      [140]={类别="扇",等级=140,名称="秋水人家"},
      [150]={类别="扇",等级=150,名称="浩气长舒"},
      [160]={类别="扇",等级=160,名称="星瀚"}},
    飞燕女={
      [70]={类别="双",等级=70,名称="赤焰双剑"},
      [80]={类别="双",等级=80,名称="赤焰双剑"},
      [90]={类别="双",等级=90,名称="灵蛇"},
      [100]={类别="双",等级=100,名称="阴阳"},
      [110]={类别="双",等级=110,名称="月光双剑"},
      [120]={类别="双",等级=120,名称="金龙双剪"},
      [130]={类别="双",等级=130,名称="连理双树"},
      [140]={类别="双",等级=140,名称="祖龙对剑"},
      [150]={类别="双",等级=150,名称="紫电青霜"},
      [160]={类别="双",等级=160,名称="浮犀"}},
    英女侠={
      [70]={类别="鞭",等级=70,名称="青藤柳叶鞭"},
      [80]={类别="鞭",等级=80,名称="青藤柳叶鞭"},
      [90]={类别="鞭",等级=90,名称="百花"},
      [100]={类别="鞭",等级=100,名称="吹雪"},
      [110]={类别="鞭",等级=110,名称="龙筋"},
      [120]={类别="鞭",等级=120,名称="仙人指路"},
      [130]={类别="鞭",等级=130,名称="血之刺藤"},
      [140]={类别="鞭",等级=140,名称="游龙惊鸿"},
      [150]={类别="鞭",等级=150,名称="牧云清歌"},
      [160]={类别="鞭",等级=160,名称="霜陨"}
      },
    狐美人={
      [70]={类别="鞭",等级=70,名称="青藤柳叶鞭"},
      [80]={类别="鞭",等级=80,名称="青藤柳叶鞭"},
      [90]={类别="鞭",等级=90,名称="百花"},
      [100]={类别="鞭",等级=100,名称="吹雪"},
      [110]={类别="鞭",等级=110,名称="龙筋"},
      [120]={类别="鞭",等级=120,名称="仙人指路"},
      [130]={类别="鞭",等级=130,名称="血之刺藤"},
      [140]={类别="鞭",等级=140,名称="游龙惊鸿"},
      [150]={类别="鞭",等级=150,名称="牧云清歌"},
      [160]={类别="鞭",等级=160,名称="霜陨"}
      },
            骨精灵={
      [70]={类别="爪",等级=70,名称="青刚刺"},
      [80]={类别="爪",等级=80,名称="青刚刺"},
      [90]={类别="爪",等级=90,名称="毒牙"},
      [100]={类别="爪",等级=100,名称="撕天"},
      [110]={类别="爪",等级=110,名称="胭脂"},
      [120]={类别="爪",等级=120,名称="贵霜之牙"},
      [130]={类别="爪",等级=130,名称="九阴勾魂"},
      [140]={类别="爪",等级=140,名称="雪蚕之刺"},
      [150]={类别="爪",等级=150,名称="忘川三途"},
      [160]={类别="爪",等级=160,名称="离钩"}
      },
     玄彩娥={
      [70]={类别="棒",等级=70,名称="满天星"},
      [80]={类别="棒",等级=80,名称="满天星"},
      [90]={类别="棒",等级=90,名称="沧海"},
      [100]={类别="棒",等级=100,名称="红莲"},
      [110]={类别="棒",等级=110,名称="盘龙"},
      [120]={类别="棒",等级=120,名称="降魔玉杵"},
      [130]={类别="棒",等级=130,名称="墨玉骷髅"},
      [140]={类别="棒",等级=140,名称="青藤玉树"},
      [150]={类别="棒",等级=150,名称="丝萝乔木"},
      [160]={类别="棒",等级=160,名称="醍醐"}
      },
    舞天姬={
      [70]={类别="飘",等级=70,名称="七彩罗刹"},
      [80]={类别="飘",等级=80,名称="七彩罗刹"},
      [90]={类别="飘",等级=90,名称="碧波"},
      [100]={类别="飘",等级=100,名称="彩虹"},
      [110]={类别="飘",等级=110,名称="流云"},
      [120]={类别="飘",等级=120,名称="此最相思"},
      [130]={类别="飘",等级=130,名称="晃金仙绳"},
      [140]={类别="飘",等级=140,名称="秋水落霞"},
      [150]={类别="飘",等级=150,名称="揽月摘星"},
      [160]={类别="飘",等级=160,名称="九霄"}
      },
     鬼潇潇={
      [70]={类别="伞",等级=70,名称="孔雀羽"},
      [80]={类别="伞",等级=80,名称="孔雀羽"},
      [90]={类别="伞",等级=90,名称="鬼骨"},
      [100]={类别="伞",等级=100,名称="云梦"},
      [110]={类别="伞",等级=110,名称="枕霞"},
      [120]={类别="伞",等级=120,名称="碧火琉璃"},
      [130]={类别="伞",等级=130,名称="雪羽穿云"},
      [140]={类别="伞",等级=140,名称="月影星痕"},
      [150]={类别="伞",等级=150,名称="浮生归梦"},
      [160]={类别="伞",等级=160,名称="晴雪"}
      },
    桃夭夭={
      [70]={类别="灯笼",等级=70,名称="玲珑盏"},
      [80]={类别="灯笼",等级=80,名称="玲珑盏"},
      [90]={类别="灯笼",等级=90,名称="蟠龙"},
      [100]={类别="灯笼",等级=100,名称="云鹤"},
      [110]={类别="灯笼",等级=110,名称="风荷"},
      [120]={类别="灯笼",等级=120,名称="金风玉露"},
      [130]={类别="灯笼",等级=130,名称="凰火燎原"},
      [140]={类别="灯笼",等级=140,名称="月露清愁"},
      [150]={类别="灯笼",等级=150,名称="夭桃秾李"},
      [160]={类别="灯笼",等级=160,名称="荒尘"}
      },
    巫蛮儿={
      [70]={类别="宝珠",等级=70,名称="如意宝珠"},
      [80]={类别="宝珠",等级=80,名称="如意宝珠"},
      [90]={类别="宝珠",等级=90,名称="离火"},
      [100]={类别="宝珠",等级=100,名称="飞星"},
      [110]={类别="宝珠",等级=110,名称="月华"},
      [120]={类别="宝珠",等级=120,名称="回风舞雪"},
      [130]={类别="宝珠",等级=130,名称="紫金葫芦"},
      [140]={类别="宝珠",等级=140,名称="裂云啸日"},
      [150]={类别="宝珠",等级=150,名称="云雷万里"},
      [160]={类别="宝珠",等级=160,名称="赤明"}
      },
    杀破狼={
      [70]={类别="弓弩",等级=70,名称="连珠神弓"},
      [80]={类别="弓弩",等级=80,名称="连珠神弓"},
      [90]={类别="弓弩",等级=90,名称="非攻"},
      [100]={类别="弓弩",等级=100,名称="幽篁"},
      [110]={类别="弓弩",等级=110,名称="百鬼"},
      [120]={类别="弓弩",等级=120,名称="冥火薄天"},
      [130]={类别="弓弩",等级=130,名称="龙鸣寒水"},
      [140]={类别="弓弩",等级=140,名称="太极流光"},
      [150]={类别="弓弩",等级=150,名称="九霄风雷"},
      [160]={类别="弓弩",等级=160,名称="若木"}
      },
      羽灵神={
      [70]={类别="法杖",等级=70,名称="腾云杖"},
      [80]={类别="法杖",等级=80,名称="腾云杖"},
      [90]={类别="法杖",等级=90,名称="业焰"},
      [100]={类别="法杖",等级=100,名称="玉辉"},
      [110]={类别="法杖",等级=110,名称="鹿鸣"},
      [120]={类别="法杖",等级=120,名称="庄周梦蝶"},
      [130]={类别="法杖",等级=130,名称="凤翼流珠"},
      [140]={类别="法杖",等级=140,名称="雪蟒霜寒"},
      [150]={类别="法杖",等级=150,名称="碧海潮生"},
      [160]={类别="法杖",等级=160,名称="弦月"}
      },
    偃无师={
      [70]={类别="巨剑",等级=70,名称="惊涛雪"},
      [80]={类别="巨剑",等级=80,名称="惊涛雪"},
      [90]={类别="巨剑",等级=90,名称="鸦九"},
      [100]={类别="巨剑",等级=100,名称="昆吾"},
      [110]={类别="巨剑",等级=110,名称="弦歌"},
      [120]={类别="巨剑",等级=120,名称="墨骨枯麟"},
      [130]={类别="巨剑",等级=130,名称="腾蛇郁刃"},
      [140]={类别="巨剑",等级=140,名称="秋水澄流"},
      [150]={类别="巨剑",等级=150,名称="百辟镇魂"},
      [160]={类别="巨剑",等级=160,名称="长息"}
      }
}
 return 武器[角色][等级]
end


function id取账号(id)
    for n, v in pairs(玩家数据) do
        if 玩家数据[n].角色.id ==id then
            return 玩家数据[n].账号
        end
    end
    return false
end

function id名称取账号(id)
    for n, v in pairs(玩家数据) do
        if 玩家数据[n].角色.名称 ==id then
            return n
        end
    end
    return false
end

function 账号取id(账号)
    for n, v in pairs(玩家数据) do
        if 玩家数据[n].账号 == 账号 then
            return n
        end
    end
    return 0
end

function 取百分比(q, w)
  local 初始百分比 = w / 100
   local  中间百分比 = q / 初始百分比
    return 中间百分比
end

function 取队伍飞升状态(id)
    for n = 1, #队伍数据[玩家数据[id].队伍].队员数据 do
        if 玩家数据[队伍数据[玩家数据[id].队伍].队员数据[n]].角色.飞升 ~= true then
            return false
        end
    end
    return true
end

function 取队伍平均等级(user)
  local  lv =0
    if user.队伍 == 0 then
        lv = user.角色.等级
    else
       dwrs = #队伍数据[user.队伍].队员数据
      for n = 1, #队伍数据[user.队伍].队员数据 do
        lv = lv + 玩家数据[队伍数据[user.队伍].队员数据[n]].角色.等级
      end
         lv = math.floor(lv / dwrs)
    end
   return lv
end

function 取队伍上限等级(id, 等级)
    local 符合等级 = {}
    if 玩家数据[id].队伍 == 0 then
        符合等级[#符合等级 + 1] = 玩家数据[id].角色.等级
    else
        for n = 1, #队伍数据[玩家数据[id].队伍].队员数据 do
            符合等级[#符合等级 + 1] = 玩家数据[队伍数据[玩家数据[id].队伍].队员数据[n]].角色.等级
        end
    end
    for n = 1, #符合等级 do
        if 符合等级[n] >= 等级 then
            return false
        end
    end
    return true
end

function 取队伍符合等级(id, 等级)
    local 符合等级 = {}
    if 玩家数据[id].队伍 == 0 then
        符合等级[#符合等级 + 1] = 玩家数据[id].角色.等级
    else
        for n = 1, #队伍数据[玩家数据[id].队伍].队员数据 do
            符合等级[#符合等级 + 1] = 玩家数据[队伍数据[玩家数据[id].队伍].队员数据[n]].角色.等级
        end
    end
    for n = 1, #符合等级 do
        if 符合等级[n] < 等级 then
            return false
        end
    end
    return true
end

function 取帮派加人权限(id, 编号)
    if 编号 == nil or 帮派数据[编号] == nil then
        return false
    else
        local 临时职务 = 帮派数据[编号].成员名单[id].职务
        if 临时职务 == "帮主" or 临时职务 == "副帮主" or 临时职务 == "长老" then
            return true
        else
            return false
        end
    end
end

function 取场景等级(map)
  if map == 1506 then--"东海湾"
    return 1,7
  elseif map == 1507 then--"东海海底"
    return 5,9
  elseif map == 1508 then--"沉船"
    return 9,13
  elseif map == 1126 then--"东海岩洞"
    return 5,12
  elseif map == 1193 then--"江南野外"
    return 6,16
  elseif map == 1004 then--"大雁塔一层"
    return 8,18
  elseif map == 1005 then--"大雁塔二层"
    return 12,22
  elseif map == 1006 then--"大雁塔三层"
    return 16,26
  elseif map == 1007 then--"大雁塔四层"
    return 20,30
  elseif map == 1008 then--"大雁塔五层"
    return 24,34
  elseif map == 1090 then--"大雁塔六层"
    return 28,38
  elseif map == 1110 then--"大唐国境"
    return 11,21
  elseif map == 1173 then--"大唐境外"
    return 20,30
  elseif map == 1091 then--"长寿郊外"
    return 26,36
  elseif map == 1512 then--"魔王寨"
    return 32,42
  elseif map == 1140 then--"普陀山"
    return 36,46
  elseif map == 1513 then--"盘丝岭"
    return 38,48
  elseif map == 1131 then--"狮驼岭"
    return 40,50
  elseif map == 1514 then--"花果山"
    return 29,39
  elseif map == 1118 then--"海底迷宫一层"
    return 33,43
  elseif map == 1119 then--"海底迷宫二层"
    return 35,45
  elseif map == 1120 then--"海底迷宫三层"
    return 37,47
  elseif map == 1121 then--"海底迷宫四层"
    return 40,55
  elseif map == 1532 then--"海底迷宫五层"
    return 55,65
  elseif map == 1127 then--"地狱迷宫一层"
    return 33,43
  elseif map == 1128 then--"地狱迷宫二层"
    return 35,45
  elseif map == 1129 then--"地狱迷宫三层"
    return 37,47
  elseif map == 1130 then--"地狱迷宫四层"
    return 40,55
  elseif map == 1202 then--"无名鬼城"
    return 100,110
  elseif map == 1174 then--"北俱芦洲"
    return 40,55
  elseif map == 1177 then--"龙窟一层"
    return 42,52
  elseif map == 1178 then--"龙窟二层"
    return 44,54
  elseif map == 1179 then--"龙窟三层"
    return 46,56
  elseif map == 1180 then--"龙窟四层"
    return 48,58
  elseif map == 1181 then--"龙窟五层"
    return 50,60
  elseif map == 1182 then--"龙窟六层"
    return 60,70
  elseif map == 1183 then--"龙窟七层"
    return 80,90
  elseif map == 1186 then--"凤巢一层"
    return 42,52
  elseif map == 1187 then--"凤巢二层"
    return 44,54
  elseif map == 1188 then--"凤巢三层"
    return 46,56
  elseif map == 1189 then--"凤巢四层"
    return 48,58
  elseif map == 1190 then--"凤巢五层"
    return 50,60
  elseif map == 1191 then--"凤巢六层"
    return 70,80
  elseif map == 1192 then--"凤巢七层"
    return 80,90
  elseif map == 1201 then--"女娲神迹"
    return 100,110
  elseif map == 1207 then--"蓬莱仙岛"
    return 130,145
  elseif map == 1203 then--小西天
    return 115,125
  elseif map == 1204 then--"小雷音寺"
    return 125,135
  elseif map == 1114 then--"月宫"
    return 40,50
  elseif map == 1231 then--"蟠桃园"
    return 150,160
  elseif map == 1218 then--"墨家"
    return 130,150
  elseif map == 1221 then--"墨家禁地"
    return 140,150
  elseif map == 1042 then--"解阳山"
    return 80,90
  elseif map == 1041 then--"子母河底"
    return 70,80
  elseif map == 1210 then--"麒麟山"
    return 90,100
  elseif map == 1228 then--"碗子山"
    return 130,140
  elseif map == 1229 then--"波月洞"
    return 150,160
  elseif map == 1233 then--"柳林坡"
    return 150,155
  elseif map == 1232 then--"比丘国"
    return 155,160
  elseif map == 1242 then--须弥东界
    return 170,180
  elseif map == 1605 then--天鸣洞天
    return 50,55
  elseif map == 1223 then--观星台
    return 50,55
  elseif map == 1876 then--南岭山
    return 30,45
  elseif map == 1920 then--"凌云渡"
    return 170,180
  end
end

function 取帮派踢人权限(id, 编号)
    if 编号 == nil or 帮派数据[编号] == nil then
        return false
    else
        local 临时职务 = 帮派数据[编号].成员名单[id].职务
        if 临时职务 == "帮主" or 临时职务 == "副帮主" then
            return true
        else
            return false
        end
    end
end

function 取队伍高于等级(id, 等级)
    local 符合等级 = {}
    if 玩家数据[id].队伍 == 0 then
        符合等级[#符合等级 + 1] = 玩家数据[id].角色.等级
    else
        for n = 1, #队伍数据[玩家数据[id].队伍].队员数据 do
            符合等级[#符合等级 + 1] = 玩家数据[队伍数据[玩家数据[id].队伍].队员数据[n]].角色.等级
        end
    end
    for n = 1, #符合等级 do
        if 等级 < 符合等级[n] then
            return false
        end
    end
    return true
end
function 是否聚宝盒(id,不提示)
       for n = 1,160 do
      if 玩家数据[id].角色.道具["包裹"][n] ~= nil and 玩家数据[id].物品[玩家数据[id].角色.道具["包裹"][n]].名称 == "聚宝盒" then
        if 不提示 == nil then
         发送数据(玩家数据[id].连接id, 7, "#G/您身上携带聚宝盒,活动获得奖励提升,获得物品几率提升,传送类功能免费")
        end
      return true
      end
    end
    return false
end
function 扣除装饰劵(id)

       for n = 1,160 do
      if 玩家数据[id].角色.道具["包裹"][n] ~= nil and 玩家数据[id].物品[玩家数据[id].角色.道具["包裹"][n]].名称 == "装饰劵" then
         发送数据(玩家数据[id].连接id, 7, "#G/扣除#R/装饰卷*1")
        道具处理类:RemoveItems(玩家数据[id],n,"装饰劵",1)
      return true
      end
    end
    发送数据(玩家数据[id].连接id, 7, "#G/您身上没有#R/装饰卷#G/，请咨询客服")
    return false
end

function 取队伍人数(id)
    if 玩家数据[id].队伍 == 0 then
        return 1
    else
        return #队伍数据[玩家数据[id].队伍].队员数据
    end
end

function 取道人时间()
    if ServerConfig.小时 == "12" or ServerConfig.小时 == "13" or ServerConfig.小时 == "14" or ServerConfig.小时 == "15" or ServerConfig.小时 == "16" or ServerConfig.小时 == "17" or ServerConfig.小时 == "18" or ServerConfig.小时 == "19" or ServerConfig.小时 == "20" then
        return true
    else
        return false
    end
end

function 取随机书铁()
    if math.random(100) <= 40 then
        return "制造指南书"
    else
        return "百炼精铁"
    end
end
function 取幸运值奖励(幸运值)
    local 奖励数={}
    local 对比数值 = {}
    local 数额 = 1
    for i=1,14 do
        对比数值[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "幸运值["..tostring(i).."]")+0
        奖励数[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "奖励次数["..tostring(i).."]")+0
    end
    if 幸运值>=对比数值[14] then
       数额 = 奖励数[14]
    elseif 幸运值>=对比数值[13] then
       数额 = 奖励数[13]
    elseif 幸运值>=对比数值[12] then
       数额 = 奖励数[12]
    elseif 幸运值>=对比数值[11] then
       数额 = 奖励数[11]
    elseif 幸运值>=对比数值[10] then
       数额 = 奖励数[10]
    elseif 幸运值>=对比数值[9] then
       数额 = 奖励数[9]
    elseif 幸运值>=对比数值[8] then
       数额 = 奖励数[8]
    elseif 幸运值>=对比数值[7] then
       数额 = 奖励数[7]
    elseif 幸运值>=对比数值[6] then
       数额 = 奖励数[6]
    elseif 幸运值>=对比数值[5] then
       数额 = 奖励数[5]
    elseif 幸运值>=对比数值[4] then
       数额 = 奖励数[4]
    elseif 幸运值>=对比数值[3] then
       数额 = 奖励数[3]
    elseif 幸运值>=对比数值[2] then
       数额 = 奖励数[2]
    elseif 幸运值>=对比数值[1] then
       数额 = 奖励数[1]
    end
    return 数额
end

function 取100级装备宝盒(幸运值)
    local 对比数值 = {}
    local 随机数 = math.random(130)
    local 物品 = ""
    if 随机数 <= 1 then
       物品 = "100级橙装宝盒"
    elseif 随机数 <= 5 then
       物品 = "100级红装宝盒"
    elseif 随机数 <= 10 then
       物品 = "100级紫装宝盒"
    elseif 随机数 <= 16 then
       物品 = "100级蓝装宝盒"
    elseif 随机数 <= 23 then
       物品 = "100级黄装宝盒"
    elseif 随机数 <= 31 then
       物品 = "100级绿装宝盒"
    else
       物品 = "100级白装宝盒"
    end
    for i=1,14 do
        对比数值[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "幸运值["..tostring(i).."]")+0
    end
    if 幸运值>=对比数值[14] then
      if 随机数 <= 15 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 33 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 52 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 72 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 93 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 115 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[13] then
      if 随机数 <= 14 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 31 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 49 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 68 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 88 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 109 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[12] then
      if 随机数 <= 13 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 29 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 46 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 64 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 83 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 103 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[11] then
      if 随机数 <= 12 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 27 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 43 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 60 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 78 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 97 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[10] then
      if 随机数 <= 11 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 25 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 40 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 56 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 73 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 91 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[9] then
      if 随机数 <= 10 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 23 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 37 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 52 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 67 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 84 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[8] then
      if 随机数 <= 9 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 21 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 34 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 48 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 63 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 79 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[7] then
      if 随机数 <= 8 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 19 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 31 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 44 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 58 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 73 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[6] then
      if 随机数 <= 7 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 17 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 28 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 40 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 53 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 67 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[5] then
      if 随机数 <= 6 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 15 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 25 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 36 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 48 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 61 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[4] then
      if 随机数 <= 5 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 13 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 22 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 32 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 43 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 55 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[3] then
      if 随机数 <= 4 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 11 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 19 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 28 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 38 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 49 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[2] then
      if 随机数 <= 3 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 9 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 16 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 24 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 33 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 43 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    elseif 幸运值>=对比数值[1] then
      if 随机数 <= 2 then
         物品 = "100级橙装宝盒"
      elseif 随机数 <= 7 then
         物品 = "100级红装宝盒"
      elseif 随机数 <= 13 then
         物品 = "100级紫装宝盒"
      elseif 随机数 <= 20 then
         物品 = "100级蓝装宝盒"
      elseif 随机数 <= 28 then
         物品 = "100级黄装宝盒"
      elseif 随机数 <= 37 then
         物品 = "100级绿装宝盒"
      else
         物品 = "100级白装宝盒"
      end
    end
    return 物品
end

function 取110级装备宝盒(幸运值)
    local 对比数值 = {}
    local 随机数 = math.random(130)
    local 物品 = ""
    if 随机数 <= 1 then
       物品 = "110级橙装宝盒"
    elseif 随机数 <= 5 then
       物品 = "110级红装宝盒"
    elseif 随机数 <= 10 then
       物品 = "110级紫装宝盒"
    elseif 随机数 <= 16 then
       物品 = "110级蓝装宝盒"
    elseif 随机数 <= 23 then
       物品 = "110级黄装宝盒"
    elseif 随机数 <= 31 then
       物品 = "110级绿装宝盒"
    else
       物品 = "110级白装宝盒"
    end
    for i=1,14 do
        对比数值[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "幸运值["..tostring(i).."]")+0
    end
    if 幸运值>=对比数值[14] then
      if 随机数 <= 15 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 33 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 52 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 72 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 93 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 115 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[13] then
      if 随机数 <= 14 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 31 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 49 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 68 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 88 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 109 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[12] then
      if 随机数 <= 13 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 29 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 46 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 64 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 83 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 103 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[11] then
      if 随机数 <= 12 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 27 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 43 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 60 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 78 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 97 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[10] then
      if 随机数 <= 11 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 25 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 40 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 56 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 73 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 91 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[9] then
      if 随机数 <= 10 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 23 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 37 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 52 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 67 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 84 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[8] then
      if 随机数 <= 9 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 21 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 34 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 48 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 63 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 79 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[7] then
      if 随机数 <= 8 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 19 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 31 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 44 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 58 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 73 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[6] then
      if 随机数 <= 7 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 17 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 28 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 40 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 53 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 67 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[5] then
      if 随机数 <= 6 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 15 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 25 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 36 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 48 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 61 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[4] then
      if 随机数 <= 5 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 13 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 22 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 32 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 43 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 55 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[3] then
      if 随机数 <= 4 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 11 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 19 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 28 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 38 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 49 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[2] then
      if 随机数 <= 3 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 9 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 16 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 24 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 33 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 43 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    elseif 幸运值>=对比数值[1] then
      if 随机数 <= 2 then
         物品 = "110级橙装宝盒"
      elseif 随机数 <= 7 then
         物品 = "110级红装宝盒"
      elseif 随机数 <= 13 then
         物品 = "110级紫装宝盒"
      elseif 随机数 <= 20 then
         物品 = "110级蓝装宝盒"
      elseif 随机数 <= 28 then
         物品 = "110级黄装宝盒"
      elseif 随机数 <= 37 then
         物品 = "110级绿装宝盒"
      else
         物品 = "110级白装宝盒"
      end
    end
    return 物品
end

function 取120级装备宝盒(幸运值)
    local 对比数值 = {}
    local 随机数 = math.random(130)
    local 物品 = ""
    if 随机数 <= 1 then
       物品 = "120级橙装宝盒"
    elseif 随机数 <= 5 then
       物品 = "120级红装宝盒"
    elseif 随机数 <= 10 then
       物品 = "120级紫装宝盒"
    elseif 随机数 <= 16 then
       物品 = "120级蓝装宝盒"
    elseif 随机数 <= 23 then
       物品 = "120级黄装宝盒"
    elseif 随机数 <= 31 then
       物品 = "120级绿装宝盒"
    else
       物品 = "120级白装宝盒"
    end
    for i=1,14 do
        对比数值[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "幸运值["..tostring(i).."]")+0
    end
    if 幸运值>=对比数值[14] then
      if 随机数 <= 15 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 33 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 52 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 72 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 93 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 115 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[13] then
      if 随机数 <= 14 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 31 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 49 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 68 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 88 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 109 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[12] then
      if 随机数 <= 13 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 29 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 46 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 64 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 83 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 103 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[11] then
      if 随机数 <= 12 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 27 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 43 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 60 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 78 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 97 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[10] then
      if 随机数 <= 11 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 25 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 40 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 56 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 73 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 91 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[9] then
      if 随机数 <= 10 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 23 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 37 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 52 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 67 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 84 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[8] then
      if 随机数 <= 9 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 21 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 34 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 48 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 63 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 79 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[7] then
      if 随机数 <= 8 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 19 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 31 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 44 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 58 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 73 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[6] then
      if 随机数 <= 7 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 17 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 28 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 40 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 53 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 67 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[5] then
      if 随机数 <= 6 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 15 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 25 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 36 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 48 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 61 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[4] then
      if 随机数 <= 5 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 13 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 22 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 32 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 43 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 55 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[3] then
      if 随机数 <= 4 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 11 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 19 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 28 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 38 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 49 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[2] then
      if 随机数 <= 3 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 9 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 16 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 24 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 33 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 43 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    elseif 幸运值>=对比数值[1] then
      if 随机数 <= 2 then
         物品 = "120级橙装宝盒"
      elseif 随机数 <= 7 then
         物品 = "120级红装宝盒"
      elseif 随机数 <= 13 then
         物品 = "120级紫装宝盒"
      elseif 随机数 <= 20 then
         物品 = "120级蓝装宝盒"
      elseif 随机数 <= 28 then
         物品 = "120级黄装宝盒"
      elseif 随机数 <= 37 then
         物品 = "120级绿装宝盒"
      else
         物品 = "120级白装宝盒"
      end
    end
    return 物品
end

function 取130级装备宝盒(幸运值)
    local 对比数值 = {}
    local 随机数 = math.random(130)
    local 物品 = ""
    if 随机数 <= 1 then
       物品 = "130级橙装宝盒"
    elseif 随机数 <= 5 then
       物品 = "130级红装宝盒"
    elseif 随机数 <= 10 then
       物品 = "130级紫装宝盒"
    elseif 随机数 <= 16 then
       物品 = "130级蓝装宝盒"
    elseif 随机数 <= 23 then
       物品 = "130级黄装宝盒"
    elseif 随机数 <= 31 then
       物品 = "130级绿装宝盒"
    else
       物品 = "130级白装宝盒"
    end
    for i=1,14 do
        对比数值[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "幸运值["..tostring(i).."]")+0
    end
    if 幸运值>=对比数值[14] then
      if 随机数 <= 15 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 33 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 52 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 72 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 93 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 115 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[13] then
      if 随机数 <= 14 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 31 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 49 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 68 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 88 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 109 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[12] then
      if 随机数 <= 13 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 29 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 46 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 64 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 83 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 103 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[11] then
      if 随机数 <= 12 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 27 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 43 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 60 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 78 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 97 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[10] then
      if 随机数 <= 11 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 25 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 40 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 56 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 73 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 91 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[9] then
      if 随机数 <= 10 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 23 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 37 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 52 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 67 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 84 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[8] then
      if 随机数 <= 9 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 21 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 34 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 48 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 63 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 79 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[7] then
      if 随机数 <= 8 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 19 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 31 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 44 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 58 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 73 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[6] then
      if 随机数 <= 7 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 17 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 28 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 40 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 53 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 67 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[5] then
      if 随机数 <= 6 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 15 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 25 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 36 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 48 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 61 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[4] then
      if 随机数 <= 5 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 13 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 22 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 32 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 43 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 55 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[3] then
      if 随机数 <= 4 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 11 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 19 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 28 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 38 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 49 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[2] then
      if 随机数 <= 3 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 9 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 16 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 24 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 33 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 43 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    elseif 幸运值>=对比数值[1] then
      if 随机数 <= 2 then
         物品 = "130级橙装宝盒"
      elseif 随机数 <= 7 then
         物品 = "130级红装宝盒"
      elseif 随机数 <= 13 then
         物品 = "130级紫装宝盒"
      elseif 随机数 <= 20 then
         物品 = "130级蓝装宝盒"
      elseif 随机数 <= 28 then
         物品 = "130级黄装宝盒"
      elseif 随机数 <= 37 then
         物品 = "130级绿装宝盒"
      else
         物品 = "130级白装宝盒"
      end
    end
    return 物品
end

function 取140级装备宝盒(幸运值)
    local 对比数值 = {}
    local 随机数 = math.random(130)
    local 物品 = ""
    if 随机数 <= 1 then
       物品 = "140级橙装宝盒"
    elseif 随机数 <= 5 then
       物品 = "140级红装宝盒"
    elseif 随机数 <= 10 then
       物品 = "140级紫装宝盒"
    elseif 随机数 <= 16 then
       物品 = "140级蓝装宝盒"
    elseif 随机数 <= 23 then
       物品 = "140级黄装宝盒"
    elseif 随机数 <= 31 then
       物品 = "140级绿装宝盒"
    else
       物品 = "140级白装宝盒"
    end
    for i=1,14 do
        对比数值[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "幸运值["..tostring(i).."]")+0
    end
    if 幸运值>=对比数值[14] then
      if 随机数 <= 15 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 33 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 52 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 72 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 93 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 115 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[13] then
      if 随机数 <= 14 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 31 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 49 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 68 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 88 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 109 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[12] then
      if 随机数 <= 13 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 29 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 46 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 64 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 83 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 103 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[11] then
      if 随机数 <= 12 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 27 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 43 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 60 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 78 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 97 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[10] then
      if 随机数 <= 11 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 25 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 40 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 56 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 73 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 91 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[9] then
      if 随机数 <= 10 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 23 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 37 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 52 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 67 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 84 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[8] then
      if 随机数 <= 9 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 21 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 34 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 48 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 63 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 79 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[7] then
      if 随机数 <= 8 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 19 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 31 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 44 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 58 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 73 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[6] then
      if 随机数 <= 7 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 17 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 28 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 40 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 53 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 67 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[5] then
      if 随机数 <= 6 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 15 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 25 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 36 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 48 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 61 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[4] then
      if 随机数 <= 5 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 13 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 22 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 32 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 43 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 55 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[3] then
      if 随机数 <= 4 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 11 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 19 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 28 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 38 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 49 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[2] then
      if 随机数 <= 3 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 9 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 16 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 24 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 33 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 43 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    elseif 幸运值>=对比数值[1] then
      if 随机数 <= 2 then
         物品 = "140级橙装宝盒"
      elseif 随机数 <= 7 then
         物品 = "140级红装宝盒"
      elseif 随机数 <= 13 then
         物品 = "140级紫装宝盒"
      elseif 随机数 <= 20 then
         物品 = "140级蓝装宝盒"
      elseif 随机数 <= 28 then
         物品 = "140级黄装宝盒"
      elseif 随机数 <= 37 then
         物品 = "140级绿装宝盒"
      else
         物品 = "140级白装宝盒"
      end
    end
    return 物品
end

function 取150级装备宝盒(幸运值)
    local 对比数值 = {}
    local 随机数 = math.random(130)
    local 物品 = ""
    if 随机数 <= 1 then
       物品 = "150级橙装宝盒"
    elseif 随机数 <= 5 then
       物品 = "150级红装宝盒"
    elseif 随机数 <= 10 then
       物品 = "150级紫装宝盒"
    elseif 随机数 <= 16 then
       物品 = "150级蓝装宝盒"
    elseif 随机数 <= 23 then
       物品 = "150级黄装宝盒"
    elseif 随机数 <= 31 then
       物品 = "150级绿装宝盒"
    else
       物品 = "150级白装宝盒"
    end
    for i=1,14 do
        对比数值[i]=f函数.读配置(ServerDirectory..[[配置文件\幸运值配置.txt]], "幸运值奖励次数", "幸运值["..tostring(i).."]")+0
    end
    if 幸运值>=对比数值[14] then
      if 随机数 <= 15 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 33 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 52 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 72 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 93 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 115 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[13] then
      if 随机数 <= 14 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 31 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 49 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 68 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 88 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 109 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[12] then
      if 随机数 <= 13 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 29 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 46 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 64 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 83 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 103 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[11] then
      if 随机数 <= 12 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 27 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 43 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 60 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 78 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 97 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[10] then
      if 随机数 <= 11 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 25 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 40 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 56 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 73 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 91 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[9] then
      if 随机数 <= 10 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 23 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 37 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 52 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 67 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 84 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[8] then
      if 随机数 <= 9 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 21 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 34 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 48 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 63 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 79 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[7] then
      if 随机数 <= 8 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 19 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 31 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 44 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 58 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 73 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[6] then
      if 随机数 <= 7 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 17 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 28 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 40 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 53 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 67 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[5] then
      if 随机数 <= 6 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 15 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 25 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 36 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 48 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 61 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[4] then
      if 随机数 <= 5 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 13 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 22 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 32 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 43 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 55 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[3] then
      if 随机数 <= 4 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 11 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 19 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 28 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 38 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 49 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[2] then
      if 随机数 <= 3 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 9 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 16 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 24 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 33 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 43 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    elseif 幸运值>=对比数值[1] then
      if 随机数 <= 2 then
         物品 = "150级橙装宝盒"
      elseif 随机数 <= 7 then
         物品 = "150级红装宝盒"
      elseif 随机数 <= 13 then
         物品 = "150级紫装宝盒"
      elseif 随机数 <= 20 then
         物品 = "150级蓝装宝盒"
      elseif 随机数 <= 28 then
         物品 = "150级黄装宝盒"
      elseif 随机数 <= 37 then
         物品 = "150级绿装宝盒"
      else
         物品 = "150级白装宝盒"
      end
    end
    return 物品
end

function 取宝石等级(数量)
  local 等级 = 0
  if  数量>0 and 数量 < 2 then
    等级 = 1
  elseif 数量>=2 and 数量<7 then
    等级 = 2
  elseif 数量 >=7 and 数量<14 then
    等级 = 3
  elseif 数量 >=14 and 数量<31 then
    等级 = 4
  elseif 数量 >=31 and 数量<61 then
    等级 = 5
  elseif 数量 >=61 and 数量<127 then
    等级 = 6
  elseif 数量 >=127 and 数量<255 then
    等级 = 7
  elseif 数量 >=255 and 数量<511 then
    等级 = 8
  elseif 数量 >=511 and 数量<1023 then
    等级 = 9
  elseif 数量 >=1023 and 数量<1535 then
    等级 = 10
  elseif 数量 >=1535 and 数量<2047 then
    等级 = 11
  elseif 数量 >=2047 and 数量<2559 then
    等级 = 12
  elseif 数量 >=2559 and 数量<3071 then
    等级 = 13
  elseif 数量 >=3071 and 数量<3583 then
    等级 = 14
  elseif 数量 >=3583 and 数量<4607 then
    等级 = 15
  elseif 数量 >=4607 and 数量<5631 then
    等级 = 16
  elseif 数量 >=5631 and 数量<6655 then
    等级 = 17
  elseif 数量 >=6655 and 数量<7679 then
    等级 = 18
  elseif 数量 >=7679 and 数量<8703 then
    等级 = 19
  elseif 数量 >=8703 and 数量<9727 then
    等级 = 20
  elseif 数量 >=9727 and 数量<10751 then
    等级 = 21
  elseif 数量 >=10751 and 数量<11775 then
    等级 = 22
  elseif 数量 >=11775 and 数量<12799 then
    等级 = 23
  elseif 数量 >=12799 and 数量<13823 then
    等级 = 24
  elseif 数量 >=13823 and 数量<15871 then
    等级 = 25
  elseif 数量 >=15871 and 数量<17919 then
    等级 = 26
  elseif 数量 >=17919 and 数量<19967 then
    等级 = 27
  elseif 数量 >=19967 and 数量<22015 then
    等级 = 28
  elseif 数量 >=22015 and 数量<24063 then
    等级 = 29
  elseif 数量 >=24063 and 数量<26111 then
    等级 = 30
  elseif 数量 >=26111 and 数量<28159 then
    等级 = 31
  elseif 数量 >=28159 and 数量<30207 then
    等级 = 32
  elseif 数量 >=30207 and 数量<32255 then
    等级 = 33
  elseif 数量 >=32255 and 数量<34303 then
    等级 = 34
  elseif 数量 >=34303 and 数量<38399 then
    等级 = 35
  elseif 数量 >=38399 and 数量<42495 then
    等级 = 36
  elseif 数量 >=42495 and 数量<46591 then
    等级 = 37
  elseif 数量 >=46591 and 数量<50687 then
    等级 = 38
  elseif 数量 >=50687 and 数量<54783 then
    等级 = 39
  elseif 数量 >=54783 and 数量<58879 then
    等级 = 40
  elseif 数量 >=58879 and 数量<62975 then
    等级 = 41
  elseif 数量 >=62975 and 数量<67071 then
    等级 = 42
  elseif 数量 >=67071 and 数量<71167 then
    等级 = 43
  elseif 数量 >=71167 and 数量<75263 then
    等级 = 44
  elseif 数量 >=75263 and 数量<79359 then
    等级 = 45
  elseif 数量 >=79359 and 数量<83455 then
    等级 = 46
  elseif 数量 >=83455 and 数量<87551 then
    等级 = 47
  elseif 数量 >=87551 and 数量<91647 then
    等级 = 48
  elseif 数量 >=91647 and 数量<95743 then
    等级 = 49
  elseif 数量 >=95743 then
    等级 = 50
  end
    return 等级
end
function 包裹转换(参数)
    if 参数 == 1 then
        return "包裹"
    elseif 参数 == 3 then
        return "法宝"
    elseif 参数 == 4 then
        return "锦衣"
    else
        return "行囊"
    end
end

function 广播消息(消息内容,序号 )
        if 序号 == nil then
            __S服务:发送(连接id, 381990,1, 消息内容)
        else
            __S服务:发送(连接id, 381990,1, 序号)
        end
end

function 广播门派消息(门派, 消息内容)
    for n, v in pairs(玩家数据) do
        if 玩家数据[n] ~= nil and 玩家数据[n].角色.门派 == 门派 then
            发送数据(玩家数据[n].连接id, 21, 消息内容)
        end
    end
end

function 广播帮派消息(门派, 消息内容)
    for n, v in pairs(帮派数据[门派].成员名单) do
        if 玩家数据[n] ~= nil then
            发送数据(玩家数据[n].连接id, 21, 消息内容)
        end
    end
end

function 广播队伍消息(id, 消息序号, 消息内容)
    if 玩家数据[id] == nil then
        return 0
    end
    if 玩家数据[id].队伍 == 0 then
        发送数据(玩家数据[id].连接id, 消息序号, 消息内容)
    else
        for n = 1, #队伍数据[玩家数据[id].队伍].队员数据 do
            发送数据(玩家数据[队伍数据[玩家数据[id].队伍].队员数据[n]].连接id,消息序号,消息内容)
        end
    end
end

function 取角色等级(id)
    return 玩家数据[id].角色.等级
end

function 取角色银子(id)
    return 玩家数据[id].角色.道具.货币.银子
end

function 取是否整除(a, b)
    if a / b ~= math.floor(a / b) then
        return false
    else
        return true
    end
end

function 银子检查(id, 数额, 储备)
    if type(玩家数据[id].角色.道具.货币.银子)~= "number" then
    封禁账号(玩家数据[id],"扣除银子")
    return
  end
    if 储备 == nil then
        if 玩家数据[id].角色.道具.货币.银子 < 数额 then
            return false
        else
            return true
        end
    elseif 数额 > 玩家数据[id].角色.道具.货币.银子 + 玩家数据[id].角色.道具.货币.储备 then
        return false
    else
        return true
    end
end

首席弟子门派类={"大唐官府","化生寺","女儿村","方寸山","天宫","龙宫","五庄观","普陀山","魔王寨","狮驼岭","盘丝洞","阴曹地府","凌波城","无底洞","神木林","花果山","天机城","女魃墓"}
灵饰属性 = {
  手镯 = {
    主属性 = {"封印命中等级","抵抗封印等级"},
    副属性 = {"气血回复效果","气血","防御","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}},
  佩饰 = {
    主属性 = {"速度"},
    副属性 = {"气血回复效果","气血","防御","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
  },
  戒指 = {
    主属性 = {"伤害","防御"},
    副属性 = {"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}},
  耳饰 = {
    主属性 = {"法术伤害","法术防御"},
    副属性 = {"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}},
  基础 = {
  封印命中等级={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=4}
    ,抵抗封印等级={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=4}
    ,防御={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=8}
    ,气血回复效果={[160]={a=21,b=40},[150]={a=15,b=30},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=4}
    ,气血={[160]={a=142,b=204},[150]={a=128,b=160},[140]={a=98,b=147},[120]={a=84,b=126},[100]={a=70,b=105},[80]={a=56,b=84},[60]={a=42,b=63},[0]=28}
    ,抗法术暴击等级={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=8}
    ,格挡值={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=8}
    ,法术防御={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=8}
    ,抗物理暴击等级={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=8}
    ,速度={[160]={a=30,b=60},[150]={a=28,b=50},[140]={a=20,b=30},[120]={a=18,b=27},[100]={a=16,b=24},[80]={a=14,b=21},[60]={a=12,b=18},[0]=3}
    ,法术伤害={[160]={a=42,b=64},[150]={a=28,b=50},[140]={a=28,b=42},[120]={a=24,b=36},[100]={a=20,b=30},[80]={a=16,b=24},[60]={a=12,b=18},[0]=4}
    ,伤害={[160]={a=22,b=44},[150]={a=28,b=32},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=4}
    ,固定伤害={[160]={a=22,b=34},[150]={a=18,b=23},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=4}
    ,法术伤害={[160]={a=22,b=44},[150]={a=21,b=30},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=4}
    ,法术暴击等级={[160]={a=22,b=44},[150]={a=18,b=23},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=4}
    ,物理暴击等级={[160]={a=22,b=44},[150]={a=18,b=23},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=4}
    ,狂暴等级={[160]={a=22,b=44},[150]={a=18,b=23},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=3}
    ,穿刺等级={[160]={a=22,b=44},[150]={a=18,b=23},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=4}
    ,法术伤害结果={[160]={a=22,b=44},[150]={a=18,b=23},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=3}
    ,治疗能力={[160]={a=22,b=44},[150]={a=18,b=23},[140]={a=14,b=21},[120]={a=12,b=18},[100]={a=10,b=15},[80]={a=8,b=12},[60]={a=6,b=9},[0]=3}}}

幻化属性基数 = {治疗能力 = 2,气血回复效果 = 2,固定伤害 = 2,气血 = 3,法术伤害结果 = 2,格挡值 = 2,法术防御 = 2,抗封印等级 = 1,狂暴等级 = 1.5,速度 = 1.5,穿刺等级 = 1.5,防御 = 1.5,抗物理暴击等级 = 1.6,法术暴击等级 = 1.5,封印命中等级 = 1,伤害 = 1.6,物理暴击等级 = 1.5,法术伤害 = 1.6,抗法术暴击等级 = 1.5}
幻化属性强化 = {狂暴等级 = 3,气血回复效果 = 5,固定伤害 = 6,气血 = 20,治疗能力 = 3,格挡值 = 4,法术伤害结果 = 5,速度 = 3,穿刺等级 = 3,防御 = 4,抗物理暴击等级 = 3,法术暴击等级 = 3,封印命中等级 = 4,伤害 = 4,物理暴击等级 = 3,法术伤害 = 4,抗法术暴击等级 = 3}
随机灵饰 = {"手镯","佩饰","戒指","耳饰"}
打造属性 = {普通 = {下限 = 1,上限 = 1.1},强化 = {下限 = 1.025,上限 = 1.25}}


function 取升级经验(id)
  local 升级经验 ={40,110,237,450,770,1252,1898,2745,3822,5159,6784,8726,11013,13674,16739,20236,24194,28641,33606,39119,45208,51902,55229,67218,75899,
  85300,95450,106377,118110,130679,144112,158438,173685,189882,207059,225244,244466,264753,286134,308639,332296,357134,383181,410466,
  439019,468868,500042,532569,566478,601799,638560,676790,716517,757770,800579,844972,890978,938625,987942,1038959,1091704,1146206,
  1202493,1260594,1320539,1382356,1446074,1511721,4079326,4548919,4820528,4994182,5569909,5647738,6068065,5727600,5840982,5840982,
  6333333,6386047,6405383,6454951,6474756,6504800,6555085,6655616,6756394,6857423,6908705,6910243,6952041,6954101,6966426,7009018,
  7551881,7705018,7958432,7121240,7306099,10450359,20998571,25199419,26406260,27619213,29838397,30063933,31295941,32534544,33779867,
  34032035,35291172,36557407,37830869,38111686,39399990,40695912,41999586,42311145,43630726,44958463,45294496,46638964,47992005,
  48353761,49724374,50103988,51249274,52890079,52298028,103715036,124104217,155570886,166002560,177548252,188949788,190427552,200915970,
  220415202,237925400,348446730,350979350,469523420,570079110,580646580,595225990,506350440,608426480,620751480,630332880,640616200,
  650888140,666891400,679345800,680018210,680142830,723036035,853089720,920618740,943994880,1290417890,1290417890,1355733180,1389305350,
  1423497240,2187474650,2240655810,2294800870,2349921400,2406029050,5336793621,8194071000,11181699470,14303066640,17561612250,999999999999,999999999999,999999999999,999999999999,999999999999,999999999999,999999999999,999999999999,999999999999}
  return 升级经验[id]
end


function 取点化石类型(技能)
 if 技能 == "水漫金山"or 技能 == "泰山压顶"or 技能 == "地狱烈火"or 技能 == "奔雷咒"or 技能 == "善恶有报"or 技能 == "力劈华山"or 技能 == "夜舞倾城"
  or 技能 == "水攻"or 技能 == "落岩"or 技能 == "雷击"or 技能 == "剑荡四方"or 技能 == "天降灵葫"or 技能 == "烈火" or 技能 == "壁垒击破"or 技能 == "进阶力劈华山" or 技能 == "进阶善恶有报" then
  return  "追加法术"
  else
    return  "附加法术"
  end
end

function 取认证技能(技能)
  if 技能=="雷击" or 技能=="落岩" or 技能=="水攻"or 技能=="烈火"or 技能=="奔雷咒"or 技能=="泰山压顶"or 技能=="水漫金山"or 技能=="地狱烈火"or 技能=="上古灵符"
or 技能=="从天而降" or 技能=="月光" or 技能=="八凶法阵" or 技能=="苍鸾怒击" or 技能=="天降灵葫" or 技能=="大快朵颐" or 技能=="龙魂"or 技能=="浮云神马"
or 技能=="哼哼哈兮" or 技能=="津津有味" or 技能=="叱咤风云" or 技能=="出其不意" or 技能=="理直气壮" or 技能=="嗜血追击" or 技能=="流沙轻音" or 技能=="食指大动"
or 技能=="溜之大吉" or 技能=="神出鬼没" or 技能=="昼伏夜出" or 技能=="高级继承" or 技能=="继承"then
    return true
   else
    return false
  end
end

function 转换灵饰等级(等级)
  if  等级 >= 160 then
    return 16
  elseif 等级 >= 140 then
    return 14
  elseif 等级 >= 120 then
    return 12
  elseif 等级 >= 100 then
    return 10
  elseif 等级 >= 80 then
    return 8
  elseif 等级 >= 60 then
    return 6
  end
end

function 取帮派数量()
  local 帮派数量 = 0
  for n, v in pairs(帮派数据) do
    if 帮派数据[n] ~= nil then
      帮派数量 = 帮派数量 + 1
    end
  end
  return 帮派数量
end

function 删除重复组(key)
  local k;
  for i=1,#key do
    for j=i+1,#key do
      if(key[i].名称 == key[j].名称)and key[j].名称~="无" then
        key[i] = - 1
      end
    end
  end
  k = 1;
  for i=1, #key do
    if (key[k] == -1) then
      key[k]={名称="无",数值=0}
      k=k - 1
    end
    k=k+1
  end
  k = nil;
end

function 删除重复(key)
  local k;
  for i=1,#key do
    for j=i+1,#key do
      if(key[i] == key[j]) then
        key[i] = - 1
      end
    end
  end
  k = 1;
  for i=1, #key do
    if (key[k] == -1) then
      table.remove(key, k);k=k - 1
    end
    k=k+1
  end
  k = nil;
  return key
end

function 取灵饰名称(类型,等级)
  local 制造灵饰 ={}
  制造灵饰.戒指={[60]="枫华戒",[80]="芙蓉戒",[100]="金麟绕",[120]="悦碧水",[140]="九曜光华",[160]="太虚渺云"}
  制造灵饰.手镯={[60]="香木镯",[80]="翡玉镯",[100]="墨影扣",[120]="花映月",[140]="金水菩提",[160]="浮雪幻音"}
  制造灵饰.耳饰={[60]="翠叶环",[80]="明月珰",[100]="玉蝶翩",[120]="点星芒",[140]="凤羽流苏",[160]="焰云霞珠"}
  制造灵饰.佩饰={[60]="芝兰佩",[80]="逸云佩",[100]="莲音玦",[120]="相思染",[140]="玄龙苍珀",[160]="碧海青天"}
 return 制造灵饰[类型][等级]
end

function AddPet(名称,类型,价格)
  if not BBData[名称] then
      print(string.format("召唤兽=%s数据不存在,请检查数据表",名称))
      return
  end
  local 神兽 ={名称=名称,参战等级 = BBData[名称].等级,灵性 = 0,类型 = 类型,特性 = "无",进阶属性 = {力量=0,敏捷=0,耐力=0,魔力=0,体质=0},最高灵性 = 0,最高灵性显示 =false,
    特性几率=0,等级=0,五行=生成五行(),寿命=5000,潜能=0,忠诚=80,炼兽真经=0,当前经验=0,升级经验=15,装备={},附加追加技能={},元宵=0,装备={},追加技能 ={},饰品=false,
    技能={},特殊资质={攻资=0,防资=0,体资=0,法资=0,速资=0,躲资=0},攻资= BBData[名称].攻资,防资= BBData[名称].防资,体资= BBData[名称].体资,法资= BBData[名称].法资,
    速资= BBData[名称].速资,躲资= BBData[名称].躲资,成长 = BBData[名称].成长[#BBData[名称].成长],道具数据={},年限=BBData[名称].年限,价格=价格}

    if 类型=="神兽" then
        神兽.造型 = string.sub(名称,1,string.find(名称, "-")-1)
        神兽.神兽升级=0
        神兽.内丹 = {总数=6,可用数量=6}
        神兽.体质=40
        神兽.魔力=40
        神兽.力量=40
        神兽.耐力=40
        神兽.敏捷=40
    else
        神兽.造型 =名称
        神兽.内丹 ={总数=math.floor(BBData[名称].等级 / 35)+1,可用数量 = math.floor(BBData[名称].等级 / 35)+1}
        神兽.体质=20
        神兽.魔力=20
        神兽.力量=20
        神兽.耐力=20
        神兽.敏捷=20
    end
    if 类型=="变异" and BBData[名称].染色方案 then
        神兽.染色组 =BBData[名称].染色组
        神兽.染色方案 = BBData[名称].染色方案
    end
    local jn = BBData[名称].技能
    for m=1,#jn do
      神兽.技能[m]=置技能(jn[m])
    end
     if BBData[名称].年限==nil then
     神兽.年限=1
  end
  神兽.重生=0
  神兽.年限=神兽.年限
 神兽.伤害=math.floor(神兽.等级*神兽.攻资*(14+10*神兽.成长)/7500+神兽.成长*神兽.力量+20+神兽.体质*0.3)
 神兽.灵力=math.floor(神兽.等级*神兽.法资/2000+神兽.成长*神兽.魔力+20)
 神兽.防御=math.floor(神兽.等级*神兽.防资*(9.4+19/3*神兽.成长)/7500+神兽.成长*(神兽.耐力+神兽.进阶属性.耐力)*4/3)
 神兽.速度=math.floor(神兽.敏捷*神兽.速资/1000)
 神兽.躲闪=math.floor(神兽.敏捷*神兽.躲资/1000)
 神兽.气血上限=math.floor(神兽.等级*神兽.体资/1000+神兽.成长*神兽.体质*6)+10
 神兽.最大气血=math.floor(神兽.等级*神兽.体资/1000+神兽.成长*神兽.体质*6)+10
 神兽.魔法上限=math.floor(神兽.等级*神兽.法资/2000+神兽.成长*神兽.魔力*2.5)
 神兽.当前气血=神兽.气血上限
 神兽.当前魔法=神兽.魔法上限
    return 神兽
end

function 取属性(模型)
  local 角色信息 = {
    飞燕女 = {模型="飞燕女",ID=1,染色方案=3,性别="女",种族="人",门派={"大唐官府","女儿村","方寸山","神木林","天机城"},武器={"双","环"}},
    英女侠 = {模型="英女侠",ID=2,染色方案=4,性别="女",种族="人",门派={"大唐官府","女儿村","方寸山","神木林","天机城"},武器={"双","鞭"}},
    逍遥生 = {模型="逍遥生",ID=4,染色方案=1,性别="男",种族="人",门派={"大唐官府","化生寺","方寸山","神木林","天机城"},武器={"扇","剑"}},
    剑侠客 = {模型="剑侠客",ID=5,染色方案=2,性别="男",种族="人",门派={"大唐官府","化生寺","方寸山","神木林","天机城"},武器={"刀","剑"}},
    狐美人 = {模型="狐美人",ID=6,染色方案=7,性别="女",种族="魔",门派={"盘丝洞","阴曹地府","魔王寨","无底洞","女魃墓"},武器={"爪","鞭"}},
    骨精灵 = {模型="骨精灵",ID=7,染色方案=8,性别="女",种族="魔",门派={"盘丝洞","阴曹地府","魔王寨","无底洞","女魃墓"},武器={"棒","爪"}},
    巨魔王 = {模型="巨魔王",ID=9,染色方案=5,性别="男",种族="魔",门派={"狮驼岭","阴曹地府","魔王寨","无底洞","女魃墓"},武器={"刀","斧"}},
    虎头怪 = {模型="虎头怪",ID=10,染色方案=6,性别="男",种族="魔",门派={"狮驼岭","阴曹地府","魔王寨","无底洞","女魃墓"},武器={"斧","锤"}},
    舞天姬 = {模型="舞天姬",ID=11,染色方案=11,性别="女",种族="仙",门派={"天宫","普陀山","龙宫","凌波城","花果山"},武器={"飘","环"}},
    玄彩娥 = {模型="玄彩娥",ID=12,染色方案=12,性别="女",种族="仙",门派={"天宫","普陀山","龙宫","凌波城","花果山"},武器={"飘","棒"}},
    神天兵 = {模型="神天兵",ID=14,染色方案=9,性别="男",种族="仙",门派={"天宫","五庄观","龙宫","凌波城","花果山"},武器={"锤","枪"}},
    龙太子 = {模型="龙太子",ID=15,染色方案=10,性别="男",种族="仙",门派={"天宫","五庄观","龙宫","凌波城","花果山"},武器={"扇","枪"}},
    巫蛮儿 = {模型="巫蛮儿",ID=3,染色方案=2083,性别="女",种族="人",门派={"大唐官府","女儿村","方寸山","神木林","天机城"},武器={"宝珠","法杖"}},
    羽灵神 = {模型="羽灵神",ID=13,染色方案=2081,性别="男",种族="仙",门派={"天宫","五庄观","龙宫","凌波城","花果山"},武器={"法杖","弓弩"}},
    桃夭夭 = {模型="桃夭夭",ID=16,染色方案=18,性别="女",种族="仙",门派={"天宫","普陀山","龙宫","凌波城","花果山"},武器={"灯笼","飘"}},
    杀破狼 = {模型="杀破狼",ID=8,染色方案=18,性别="男",种族="魔",门派={"狮驼岭","阴曹地府","魔王寨","无底洞","女魃墓"},武器={"宝珠","弓弩"}},
    偃无师 = {模型="偃无师",ID=17,染色方案=18,性别="男",种族="人",门派={"大唐官府","化生寺","方寸山","神木林","天机城"},武器={"巨剑","剑"}},
    鬼潇潇 = {模型="鬼潇潇",ID=18,染色方案=18,性别="女",种族="魔",门派={"盘丝洞","阴曹地府","魔王寨","无底洞","女魃墓"},武器={"伞","爪"}},
  }
  return 角色信息[模型]
end

function 取符石(等级)---最高3级 以后有4级可以在这里加
  local 符石= {}
   if 等级 == 2 then
    符石 = {"碧玉符石","金光符石","天神符石","飘渺符石","天仙符石","霞光符石","逍遥符石",}
  elseif 等级 ==1 then
    符石 = {"冰符石","土符石","雷符石","电符石","风符石","炎符石","火符石"}
   else
    符石 = {"虹珀符石","陌影符石","北冥符石","灵月符石","锦瑟符石","银光符石","清心符石","星辰符石","雪月符石","玄魂符石","乾坤符石","珍珀符石",
  "银竹符石","神川符石","玲珑符石","暮影符石","天珍符石","九影符石","百冥符石","莫念符石","醉魂符石","玄羽符石","霸风符石","无相符石",
  "无极符石","紫晶符石","圣火符石","昔光符石","子蚀符石","流风符石","地炎符石","素影符石","燕灵符石","降龙符石","苍玉符石","流魂符石",
  "九凤符石","墨陀符石","南夕符石","引幽符石","波涛符石","铃星符石","狂念符石","乱花符石","幽月符石","两仪符石","七情符石","召影符石"}
   end
   return  符石[math.random(1,#符石)]
end

function 取随机坐骑饰品()
local 饰品 = {"展翅高飞" ,"旗开得胜","霸王雄风" ,"独眼观天" ,"威武不屈" ,"深藏不露" ,"异域浓情" ,"流星天马" ,"威猛将军" ,"知情达理",
"气宇轩昂","如花似玉" ,"傲视天下" ,"铁血豪情" ,"唯我独尊","叱咤风云" ,"异域风情" ,"假面勇者" ,"霓裳魅影","披星戴月" ,"烈焰燃情",
"天雨流芳" ,"灵光再现" ,"倾国倾城"}
 return  饰品[math.random(1,#饰品)]
end

function 取随机灵饰特性()
local 灵饰特性 = {"金石之坚","参天古木","波浪滔天","烈火燎原","水来土掩","气血方刚","通真达灵","心无旁骛","健步如飞","回春之术","风雨不动","回若金汤",
"气壮山河","锐不可当","宿敌·大唐官府","宿敌·化生寺","宿敌·女儿村","宿敌·神木林","宿敌·方寸山","宿敌·天机城","宿敌·天宫","宿敌·花果山",
"宿敌·龙宫","宿敌·五庄观","宿敌·凌波城","宿敌·普陀山","宿敌·阴曹地府","宿敌·盘丝洞","宿敌·狮驼岭","宿敌·女魅墓","宿敌·魔王寨","宿敌·无底洞",
"自我陶醉","傲娇海星","弱点击破","破碎无双","破血狂攻","心如明镜","天衣无缝","绝幻魔音","身似菩提","移形换影","回魂咒","法术吸收","心狠手辣","心源","御兽之道","无懈可击","对酒当歌"}
 return  灵饰特性[math.random(1,#灵饰特性)]
end
function 取随机灵犀玉特性()
local 灵饰特性 = {"相生","相克","聚气","金耀","木耀","水耀","火耀","土耀","利金","利木","利水","利火",
"利土","天平","蔓延"}
 return  灵饰特性[math.random(1,#灵饰特性)]
end
function 取随机所有宝石()

local 宝石 = {"速度精魄灵石","气血精魄灵石", "灵力精魄灵石","躲避精魄灵石","防御精魄灵石","伤害精魄灵石","光芒石","月亮石","太阳石","舍利子","红玛瑙","黑宝石","神秘石"}
 return  宝石[math.random(1,#宝石)]
end
function 取随机宝石()
  local 宝石 = {"光芒石","月亮石","太阳石","舍利子","红玛瑙","黑宝石","神秘石"} --"红宝石","绿宝石","蓝宝石","黄宝石",
  return  宝石[math.random(1,#宝石)]
end

function 取随机红包()
  local 红包 = {"红包-我","红包-为","红包-国","红包-喝","红包-彩"}
  return  红包[math.random(1,#红包)]
end

function 取召唤兽随机宝石()
  local 宝石 = {"速度精魄灵石","气血精魄灵石", "灵力精魄灵石","躲避精魄灵石","防御精魄灵石","伤害精魄灵石"}
  return  宝石[math.random(1,#宝石)]
end

function 取随机强化石()
    local  临时名称 = {"青龙石","玄武石","朱雀石","白虎石"}
    return 临时名称[math.random( 4)]
end
function 取随机符石()
    local  临时名称 = {"一级未激活符石","三级未激活符石","二级未激活符石","一级未激活符石","一级未激活符石","二级未激活符石","二级未激活符石","二级未激活符石","一级未激活符石","一级未激活符石","一级未激活符石"}
    return 临时名称[math.random(11)]
end
function 取随机强化珠()
if 装备强化 then
    local  临时名称 = {"武器强化珠","衣服强化珠","头盔强化珠","项链强化珠","腰带强化珠","鞋子强化珠","耳饰强化珠","配饰强化珠","戒指强化珠","手镯强化珠"}
    return 临时名称[math.random(10)]
  else
      local  临时名称 = { "夜光珠","避水珠","龙鳞","定魂珠","金刚石"}
    return 临时名称[math.random( 5)]
  end


end
function 取随机五宝()
    local  临时名称 = {"夜光珠","避水珠","龙鳞","定魂珠","金刚石"}
    return 临时名称[math.random( 5)]
end
------------------------------------------新加
function 取内丹(类型)
    local 普通内丹 = {"迅敏","狂怒","阴伤","静岳","擅咒","灵身","矫健","深思","钢化","坚甲","慧心","撞击","无畏","愤恨","淬毒","狙刺","连环","圣洁","灵光"}
    local 高级内丹 = {"神机步","腾挪劲","玄武躯","龙胄铠","玉砥柱","碎甲刃","阴阳护","凛冽气","舍身击","电魂闪","通灵法","双星爆","催心浪","隐匿击","生死决","血债偿"}
    local 天命内丹 = {"迅敏","狂怒","阴伤","静岳","擅咒","灵身","矫健","慧心","撞击","连环","圣洁","灵光"}
   if 类型 == "高级"  then
      return 高级内丹[math.random(1,#高级内丹)]
   else
       return 普通内丹[math.random(1,#普通内丹)]
   end
   if 类型 == "天命"  then
    return 天命内丹[math.random(1,#天命内丹)]
   end
end

function 取等级卡片(等级)
      local 卡片 ={
      [1]={"海星","狸","章鱼","大海龟","大蝙蝠","赌徒","海毛虫","护卫","巨蛙","强盗","山贼","树怪" },
      [2]={"蛤蟆精","黑熊","狐狸精","花妖","老虎","羊头怪","骷髅怪"},
      [3]= {"狼","牛妖","虾兵","小龙女","蟹将","野鬼"},
      [4]={"龟丞相","黑熊精","僵尸","马面","牛头","兔子怪","蜘蛛精"},
      [5]={"白熊","古代瑞兽","黑山老妖","蝴蝶仙子","雷鸟人"},
      [6]={"地狱战神","风伯","天兵","天将","凤凰" ,"雨师","蛟龙","蚌精","碧水夜叉"},
      [7]={"百足将军","锦毛貂精","镜妖","泪妖","千年蛇魅","如意仙子","鼠先锋","星灵仙子","巡游天神","野猪精","芙蓉仙子","犀牛将军人形","犀牛将军兽形","阴阳伞"},
      [8]={"巴蛇","龙龟","大力金刚","鬼将","红萼仙子","葫芦宝贝","画魂","机关鸟","机关人","机关兽","金饶僧" ,"净瓶女娲","连弩车","灵鹤","灵符女娲","律法女娲","琴仙","踏云兽","雾中仙","吸血鬼","噬天虎","炎魔神","幽灵","幽莹娃娃","夜罗刹"},
      [9]={"毗舍童子","长眉灵猴","持国巡守","混沌兽","金身罗汉","巨力神猿","狂豹人形","狂豹兽形","曼珠沙华","猫灵人形","猫灵兽形","藤蔓妖花","蝎子精","修罗傀儡鬼","修罗傀儡妖","增长巡守","真陀护法","蜃气妖","灵灯侍者"},
      [10]={"般若天女"} }
    return 卡片[等级][math.random(1,#卡片[等级])]
end

function 取法宝经验(名称,等级)
  等级= 等级+1
  local 类型 = assert(ItemData[名称].等级,"取法宝经验错误法宝"..名称.."名称不存在请检查数据表")
  local 经验
  local bl = 5
  if 类型 == 1 then
  经验 = {220375*bl,553000*bl,1355125*bl,2884000*bl,5396875*bl,9151000*bl,14403625*bl,21412000*bl,30433376*bl,"无法提升"}
  elseif 类型 == 2 then
  经验 ={210268*bl,472144*bl,1082236*bl,2237152*bl,4133500*bl,6967888*bl,10936924*bl,16237261*bl,23065372*bl,31618000*bl,42091708*bl,54683104*bl,"无法提升"}
  elseif  类型 == 3 then
  经验 ={199452*bl,385616*bl,790204*bl,1544928*bl,2781500*bl,4631632*bl,7227036*bl,10699424*bl,15180508*bl,20802000*bl,27695612*bl,35993056*bl,45826044*bl,57326288*bl,70625500*bl,"无法提升"}
  elseif  类型 == 4 then
  经验 ={1834389*bl,2935112*bl,4348503*bl,6220896*bl,8698625*bl,11928024*bl,16055427*bl,21227168*bl,27589581*bl,35289000*bl,44471759*bl,55284192*bl,67872633*bl,82383416*bl,98962875*bl,117757344*bl,138913157*bl,162576648*bl,"无法提升"}
  end
  return 经验[等级]
end
function 生成技能词条()

      local 范围={"血上限","职业能力","打击攻击","会心攻击","力量","筋骨","体质","灵气","身法","技巧","物法伤害结果"}
    local 技能词条 = {}
            if math.random(100)<= 80 then
             技能词条[1]=范围[math.random(1,#范围)]
              if math.random(100)<=70 then
                local 临时特效=范围[math.random(1,#范围)]
                  if 临时特效~=技能词条[1] then
                   技能词条[2]=临时特效
              if math.random(100)<=60 then
                 临时特效=范围[math.random(1,#范围)]
                   if 临时特效~=技能词条[1] and 临时特效~=技能词条[2] then
                    技能词条[3]=临时特效
               if math.random(100)<=30 then
                      临时特效=范围[math.random(1,#范围)]
                       if 临时特效~=技能词条[1] and 临时特效~=技能词条[2] and 临时特效~=技能词条[3] and math.random(100)<=50 then
                       技能词条[4]=临时特效
               if math.random(100)<=20  then
                           临时特效=范围[math.random(1,#范围)]
                           if 临时特效~=技能词条[1] and 临时特效~=技能词条[2] and 临时特效~=技能词条[3]  and 临时特效~=技能词条[4] and math.random(100)<=50 then
                             技能词条[5]=临时特效
                           end
                         end
                       end
                    end
                   end
                  end
               end
                end
             end
  return  技能词条
 end

  function 生成强化额外技能()

      local 范围={"猛将","贤者","隐者","药师","无名"}
    local 技能词条 = 范围[math.random(1,#范围)]

  return  技能词条
 end

function AddItem(名称,等级,技能,数量,价格,id,图标,概率,限时)
  local 道具 ={}
      道具.名称=名称
      道具.概率=概率
      道具.图标= 图标
      if 限时 then
        道具.Time=os.time()+限时
      end
      if not ItemData[名称] then
        __S服务:输出(string.format("AddItem数据错误请检查数据表名称=%s",名称))
          return
      else
          道具.类型=ItemData[名称].类型
      end
    if 价格==nil then
        道具.价格 = ItemData[名称].价格
    else
      道具.价格=价格
    end
    if ItemData[名称].叠加 then
      道具.数量 = 数量 or  1
    end


    if 道具.类型== "法宝" then
      道具.层数 = 0
      道具.当前经验 = 0
      道具.最大经验 = 取法宝经验(名称,道具.层数)
      道具.五行 = 生成五行()
      道具.灵气 = 100
       if ItemData[名称].属性.佩戴  and ItemData[名称].等级  ==4  then
      道具.额外技能  = "未激活"
      道具.额外技能等级  = 0
    道具.额外技能强化 = 0
      道具.技能词条  = {}
        道具.技能词条  =生成技能词条()
    end
      elseif 道具.类型== "龙魂" then--龙魂系统
      local 部位类型 = {"一号","二号","三号","四号","五号","六号","七号","八号"}
       一号范围 = {"伤害","命中","物理暴击等级","狂暴等级","穿刺等级","封印命中等级"}
       二号范围 = {"伤害","命中","物理暴击等级","穿刺等级","狂暴等级","封印命中等级"}
       三号范围 = {"灵力","法术暴击等级","固定伤害","法术伤害","法术伤害结果","魔法"}
       四号范围 = {"灵力","法术暴击等级","固定伤害","法术伤害","法术伤害结果","魔法"}
       五号范围 = {"气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级"}
       六号范围 = {"气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级"}
       七号范围 = {"格挡值","防御","速度","气血回复效果","治疗能力"}
       八号范围 = {"格挡值","防御","速度","气血回复效果","治疗能力"}
      龙魂数值 = {
     封印命中等级={12,36},抵抗封印等级={12,36},防御={12,36},气血回复效果={6,18},气血={42,126}
    ,抗法术暴击等级={12,36},格挡值={12,36},法术防御={12,36},抗物理暴击等级={12,36},速度={12,36}
    ,法术伤害={12,36},伤害={6,18},固定伤害={6,18},法术伤害={6,18},法术暴击等级={6,18},物理暴击等级={6,18}
    ,狂暴等级={6,18},穿刺等级={6,18},法术伤害结果={6,18},治疗能力={6,18},魔法={42,126},躲避={12,27},灵力={6,18}
    ,命中={12,36}   }
      道具.部位=部位类型[math.random(1,#部位类型)]
      道具.等级=1
      道具.门派=首席弟子门派类[math.random(1,#首席弟子门派类)]
      道具.突破=0
      道具.强化=false
      if 道具.名称 == "绿色龙魂" then
         道具.龙魂属性={[1]={类型="物理暴击等级",数值=6},[2]={类型="治疗能力",数值=7}}
      elseif 道具.名称 == "蓝色龙魂" then
         道具.龙魂属性={[1]={类型="物理暴击等级",数值=6},[2]={类型="治疗能力",数值=7},[3]={类型="抵抗封印等级",数值=5}}
      elseif 道具.名称 == "紫色龙魂" then
         道具.龙魂属性={[1]={类型="物理暴击等级",数值=6},[2]={类型="治疗能力",数值=7},[3]={类型="抵抗封印等级",数值=5},[4]={类型="魔法",数值=35}}
      elseif 道具.名称 == "红色龙魂" then
         道具.龙魂属性={[1]={类型="物理暴击等级",数值=6},[2]={类型="治疗能力",数值=7},[3]={类型="抵抗封印等级",数值=5},[4]={类型="魔法",数值=35},[5]={类型="气血回复效果",数值=6}}
      end

      if 道具.部位 == "一号" then
      道具.固定类型="伤害"
      道具.固定属性=math.random(6,18)

      elseif 道具.部位 == "二号" then
      道具.固定类型="气血"
      道具.固定属性=math.random(42,126)

      elseif 道具.部位 == "三号" then
      道具.固定类型="防御"
      道具.固定属性=math.random(12,36)

      elseif 道具.部位 == "四号" then
      道具.固定类型="速度"
      道具.固定属性=math.random(12,36)

      elseif 道具.部位 == "五号" then
      道具.固定类型="灵力"
      道具.固定属性=math.random(6,18)

      elseif 道具.部位 == "六号" then
      道具.固定类型="封印命中等级"
      道具.固定属性=math.random(12,36)

      elseif 道具.部位 == "七号" then
      道具.固定类型="法术防御"
      道具.固定属性=math.random(12,36)

      elseif 道具.部位 == "八号" then
      道具.固定类型="气血回复效果"
      道具.固定属性=math.random(6,18)
      end
      elseif 道具.名称== "一级灵犀玉" then
    道具.等级 = 1
    if math.random(100) < 50 then
    道具.特性 = 取随机灵犀玉特性()
    end
        elseif 道具.名称== "二级灵犀玉" then
    道具.等级 = 2
    if math.random(100) < 50 then
    道具.特性 =取随机灵犀玉特性()
    end
            elseif 道具.名称== "三级灵犀玉" then
    道具.等级 = 3
    if math.random(100) < 50 then
    道具.特性 = 取随机灵犀玉特性()
end
       ---------------------------------------
      elseif 道具.类型=="矿区" then--矿区系统
      local 部位类型 = {"一号","二号","三号","四号","五号","六号","七号","八号","九号","十号","十一号","十二号","十三号","十四号","十五号","十六号","十七号","十八号","十九号",
     "二拾号","二拾一号","二拾二号","二拾三号","二拾四号","二拾五号","二拾六号","二拾七号","二拾八号","二拾九号","三拾号","三拾一号","三拾二号","三拾三号","三拾四号","三拾五号",
     "三拾六号","三拾七号","三拾八号","三拾九号","四拾号"}
       一号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       二号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       三号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       四号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       五号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       六号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       七号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       八号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       九号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       十号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
       十一号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十二号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十三号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十四号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十五号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十六号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十七号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十八号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     十九号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾一号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾二号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾三号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾四号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾五号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾六号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾七号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾八号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     二拾九号范围 ={"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾一号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾二号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾三号范围 = {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾四号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾五号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾六号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾七号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾八号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     三拾九号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
     四拾号范围 =  {"伤害","命中","狂暴等级","穿刺等级","封印命中等级","灵力","固定伤害","法术伤害","法术伤害结果","魔法","气血","防御","法术防御","抗物理暴击等级","抗法术暴击等级","抵抗封印等级","格挡值","速度","气血回复效果","治疗能力","力量","敏捷","魔力","体质","耐力"}
      矿区数值 = {
     封印命中等级={1,3},抵抗封印等级={1,3},防御={5,10},气血回复效果={6,18},气血={30,80}
    ,抗法术暴击等级={1,3},格挡值={3,8},法术防御={5,10},抗物理暴击等级={1,3},速度={5,10}
    ,法术伤害={5,10},伤害={5,10},固定伤害={10,20},法术伤害={5,10},法术暴击等级={1,3},物理暴击等级={1,3}
    ,狂暴等级={3,8},穿刺等级={3,8},法术伤害结果={5,10},治疗能力={10,30},魔法={20,30},躲避={5,10},灵力={5,10}
    ,命中={10,20},力量={5,10},敏捷={5,10},魔力={5,10},体质={5,10},耐力={5,10}   }
      道具.部位=部位类型[math.random(1,#部位类型)]
      道具.等级=1
      道具.门派=首席弟子门派类[math.random(1,#首席弟子门派类)]
      道具.突破=0
      道具.强化=false
      if 道具.名称 =="银曜石" then
         道具.矿区属性={[1]={类型="速度",数值=3},[2]={类型="气血",数值=10}}
      elseif 道具.名称 =="绿翡翠" then
         道具.矿区属性={[1]={类型="速度",数值=3},[2]={类型="气血",数值=10},[3]={类型="抵抗封印等级",数值=8}}
      elseif 道具.名称 =="蓝色宝石" then
         道具.矿区属性={[1]={类型="速度",数值=3},[2]={类型="气血",数值=10},[3]={类型="抵抗封印等级",数值=3},[4]={类型="魔法",数值=35}}
      elseif 道具.名称 =="紫水晶" then
         道具.矿区属性={[1]={类型="速度",数值=3},[2]={类型="气血",数值=10},[3]={类型="抵抗封印等级",数值=3},[4]={类型="魔法",数值=35},[5]={类型="气血回复效果",数值=6}}
      elseif 道具.名称 =="红碧玺" then
         道具.矿区属性={[1]={类型="速度",数值=3},[2]={类型="气血",数值=10},[3]={类型="抵抗封印等级",数值=3},[4]={类型="魔法",数值=35},[5]={类型="气血回复效果",数值=6},[6]={类型="穿刺等级",数值=6}}
      elseif 道具.名称 =="黄金" then
         道具.矿区属性={[1]={类型="速度",数值=3},[2]={类型="气血",数值=10},[3]={类型="抵抗封印等级",数值=3},[4]={类型="魔法",数值=35},[5]={类型="气血回复效果",数值=6},[6]={类型="穿刺等级",数值=6},[7]={类型="狂暴等级",数值=6}}
      end

      if 道具.部位 =="一号" then
      道具.固定类型="气血"
      道具.固定属性=math.random(30,80)

      elseif 道具.部位 =="二号" then
      道具.固定类型="气血"
      道具.固定属性=math.random(30,80)

      elseif 道具.部位 =="三号" then
      道具.固定类型="速度"
      道具.固定属性=math.random(3,3)

      elseif 道具.部位 =="四号" then
      道具.固定类型="速度"
      道具.固定属性=math.random(3,3)

      elseif 道具.部位 =="五号" then
      道具.固定类型="抗物理暴击等级"
      道具.固定属性=math.random(3,3)

      elseif 道具.部位 =="六号" then
      道具.固定类型="抗物理暴击等级"
      道具.固定属性=math.random(3,3)

      elseif 道具.部位 =="七号" then
      道具.固定类型="法术防御"
       道具.固定属性=math.random(3,3)

      elseif 道具.部位 =="八号" then
      道具.固定类型="法术防御"
       道具.固定属性=math.random(3,3)
    elseif 道具.部位 =="九号" then
      道具.固定类型="气血回复效果"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十号" then
        道具.固定类型="气血回复效果"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十一号" then
        道具.固定类型="灵力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十二号" then
      道具.固定类型="灵力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十三号" then
      道具.固定类型="防御"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十四号" then
      道具.固定类型="防御"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十五号" then
      道具.固定类型="抵抗封印等级"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十六号" then
      道具.固定类型="抵抗封印等级"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十七号" then
      道具.固定类型="封印命中等级"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十八号" then
      道具.固定类型="封印命中等级"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="十九号" then
      道具.固定类型="治疗能力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾号" then
      道具.固定类型="治疗能力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾一号" then
      道具.固定类型="伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾二号" then
      道具.固定类型="伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾三号" then
      道具.固定类型="伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾四号" then
      道具.固定类型="伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾五号" then
      道具.固定类型="伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾六号" then
      道具.固定类型="伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾七号" then
      道具.固定类型="法术伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾八号" then
      道具.固定类型="法术伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="二拾九号" then
        道具.固定类型="固定伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾号" then
        道具.固定类型="固定伤害"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾一号" then
      道具.固定类型="魔力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾二号" then
        道具.固定类型="魔力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾三号" then
        道具.固定类型="耐力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾四号" then
      道具.固定类型="耐力"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾五号" then
      道具.固定类型="体质"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾六号" then
        道具.固定类型="体质"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾七号" then
        道具.固定类型="敏捷"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾八号" then
      道具.固定类型="敏捷"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="三拾九号" then
        道具.固定类型="力量"
      道具.固定属性=math.random(3,3)
      elseif 道具.部位 =="四拾号" then
        道具.固定类型="力量"
      道具.固定属性=math.random(3,3)
      end
      ------------------
    elseif 道具.类型== "符石" then
        道具.耐久 = 500
    elseif 道具.类型 =="药品" then
        if ItemData[名称].等级 ==3 then
            道具.品质 = 20 or 等级
        end
    elseif 道具.名称=="怪物卡片" then
          道具.类型=技能
          道具.使用次数= CardData[技能].卡片等级
    elseif 道具.类型 =="烹饪" then
        道具.品质 = 等级 or  10
    elseif 道具.类型 == "打造"  then
            if  道具.名称=="上古锻造图策" then
             local 临时名称1 = {"铠甲","项圈","护腕"}
            道具.种类=技能 or   临时名称1[math.random( 3)]
             if  等级>=155 then
               道具.等级=155
             else
              道具.等级=等级
             end
            elseif 道具.名称 == "九眼天珠" or 道具.名称 == "三眼天珠"or 道具.名称 == "天眼珠" then
              道具.等级=等级
              道具.灵气 =math.random(5,100)
            elseif 道具.名称 == "钨金" then
              道具.等级=等级 or math.random(6,13)*10
            elseif  道具.名称 == "战魄" then
             道具.等级=160
            elseif 道具.名称 == "珍珠" or  道具.名称 == "百炼精铁"  then
             道具.等级=等级 or  math.random(3, 7)*10
            elseif 道具.名称 == "制造指南书" then
              道具.等级=等级 or math.random(3, 7)*10
              local TempType={[1]="剑",[2]="扇",[3]="锤",[4]="枪",[5]="刀",[6]="斧",[7]="环",[8]="双",[9]="飘",[10]="棒",
            [11]="爪",[12]="鞭",[13]="伞",[14]="巨剑",[15]="宝珠",[16]="法杖",[17]="弓弩",[18]="灯笼",[19]="项链",[20]="鞋子",[21]="男衣",[22]="女衣",[23]="头盔",[24]="发钗",[25]="腰带"}
             道具.等级=等级
             道具.种类 =技能 or TempType[math.random(1,#TempType)]
            else
             道具.等级=等级
             道具.种类 =技能
            end
    elseif 道具.类型 == "元身"  then--------修改
          道具.等级=160
          道具.种类= ItemData[名称].种类
          if 道具.种类=="爪" or 道具.种类=="法杖" or 道具.种类=="鞭"  or 道具.种类=="双" or 道具.种类=="环" or 道具.种类=="扇" or 道具.种类=="伞" or 道具.种类=="枪" or 道具.种类=="飘" or 道具.种类=="棒" or 道具.种类=="巨剑" or 道具.种类=="剑" or 道具.种类=="弓弩" or 道具.种类=="斧" or 道具.种类=="灯笼" or 道具.种类=="刀" or 道具.种类=="锤" or 道具.种类=="宝珠" then
          道具.伤害=math.random(math.floor((16*30+10)*1.15),math.floor((16*30+10)*1.3))
          道具.命中=math.random(math.floor((16*35+10)*1.15),math.floor((16*35+10)*1.3))
                if math.random(100) <= 50 then
               道具.属性={[1]={全局变量.基础属性[math.random(1,#全局变量.基础属性)],math.random(2)}}
                if math.random(100) <= 20 then
                  道具.属性[2]={全局变量.基础属性[math.random(1,#全局变量.基础属性)],math.random(2)}
                end
              end
          elseif 道具.种类=="衣服" or 道具.种类=="男衣" or 道具.种类=="女衣" then
              道具.防御=math.random(math.floor((16*15+25)*1.15),math.floor((16*15+25)*1.3))
              if math.random(100) <= 50 then
               道具.属性={[1]={全局变量.基础属性[math.random(1,#全局变量.基础属性)],math.random(2)}}
                if math.random(100) <= 20 then
                  道具.属性[2]={全局变量.基础属性[math.random(1,#全局变量.基础属性)],math.random(2)}
                end
              end

          elseif 道具.种类=="项链" then
              道具.灵力=math.random(math.floor((16*12+5)*1.15),math.floor((16*12+5)*1.3))
          elseif 道具.种类=="鞋子" then
              道具.防御=math.random(math.floor((16*5+5)*1.15),math.floor((16*5+5)*1.3))
              道具.敏捷=math.random(math.floor((16*3+5)*1.15),math.floor((16*3+5)*1.3))
          elseif 道具.种类=="腰带" then
            道具.防御=math.random(math.floor((16*5+5)*1.15),math.floor((16*5+5)*1.3))
            道具.气血=math.random(math.floor((16*20+10)*1.15),math.floor((16*20+10)*1.3))
          elseif 道具.种类=="头盔" or 道具.种类=="发钗" then
              道具.防御=math.random(math.floor((16*5+5)*1.15),math.floor((16*5+5)*1.3))
              道具.魔法=math.random(math.floor((16*10+5)*1.15),math.floor((16*10+5)*1.3))
          end
           if math.random(100)<= 20 then
            道具.特效=math.random(15)
           end
           if math.random(100)<=10 then
            道具.特技=math.random(15)
           end
    elseif 道具.类型 == "宝石"then
      if 道具.名称 == "星辉石" then
        道具.等级=等级 or 1
      else
        道具.等级=等级 or math.random(3)
      end

    elseif 道具.名称=="鬼谷子" then
          local lslx = {"鸟翔阵","天覆阵","云垂阵","地载阵","风扬阵","龙飞阵","虎翼阵","蛇蟠阵","雷绝阵","鹰啸阵"}
         道具.技能=技能 or lslx[math.random(1,#lslx)]
    elseif 道具.类型=="合成旗" then
         道具.坐标={}
         道具.地图编号=0
         道具.次数 = 140
         if 道具.名称 == "红色合成旗" then
       道具.地图编号 =1001
     道具.地图 ="长安城"
         道具.坐标={[1]={x=208,y=109},[2]={x=468,y=249},[3]={x=49,y=261},[4]={x=414,y=49},[5]={x=281,y=240},[6]={x=473,y=197},[7]={x=520,y=95}}
    elseif 道具.名称 == "黄色合成旗" then
         道具.地图编号 =1208
     道具.地图 ="朱紫国"
         道具.坐标={[1]={x=142,y=26},[2]={x=16,y=17},[3]={x=12,y=108},[4]={x=160,y=109},[5]={x=89,y=59},[6]={x=73,y=102},[7]={x=181,y=53}}


    elseif 道具.名称 == "白色合成旗" then
         道具.地图编号 =1070
     道具.地图 ="长寿村"
         道具.坐标={[1]={x=118,y=156},[2]={x=139,y=198},[3]={x=47,y=192},[4]={x=61,y=113},[5]={x=130,y=39},[6]={x=108,y=14},[7]={x=137,y=122}}

        elseif 道具.名称 == "蓝色合成旗" then
         道具.地图编号 =1501
     道具.地图 ="建邺城"
         道具.坐标={[1]={x=43,y=123},[2]={x=102,y=85},[3]={x=73,y=52},[4]={x=232,y=17},[5]={x=184,y=67},[6]={x=271,y=108},[7]={x=157,y=118}}

    elseif 道具.名称 == "绿色合成旗" then
         道具.地图编号 =1092
     道具.地图 ="傲来国"
         道具.坐标={[1]={x=124,y=55},[2]={x=203,y=9},[3]={x=189,y=83},[4]={x=167,y=131},[5]={x=50,y=134},[6]={x=508,y=63},[7]={x=19,y=16}}

     end



         道具.次数 = 140
    elseif 道具.类型=="超级合成旗" then
         道具.坐标={}
         道具.地图编号=0
         道具.次数 = 120
    elseif 道具.类型=="导标旗" then
         道具.地图编号=0
         道具.次数 = 20
         elseif 道具.类型=="召唤兽装备" then
    if 道具.名称=="星光护符"  then

              道具.护符技能= 取星光护符名称()  --取星光护符名称--取月光护符名称--取阳光护符名称--取银河加护名称

        elseif 道具.名称=="月光护符"  then

              道具.护符技能= 取月光护符名称()
        elseif 道具.名称=="阳光护符"  then

              道具.护符技能= 取阳光护符名称()
         elseif 道具.名称=="银河加护"  then

              道具.护符技能= 取银河加护名称()
      end
    elseif 道具.类型=="召唤兽道具" then
       if 道具.名称=="高级清灵仙露" then
             道具.灵气 = math.random(4,8)
        elseif 道具.名称=="中级清灵仙露" then
             道具.灵气   =math.random(2,6)
        elseif 道具.名称=="初级清灵仙露" then
             道具.灵气  = math.random(5)
        elseif 道具.名称=="元宵"  then
            local 资质标识={"体资","攻资","防资","法资","速资","躲资"}
            道具.参数=技能 or 资质标识[math.random(1,#资质标识)]
        elseif  道具.名称=="月华露" then
            道具.品质 = 等级 or math.random(2,10)*100
         end
    elseif 道具.类型 == "炼妖"  then
          if  道具.名称=="召唤兽内丹"  then
              道具.技能= 技能 or 取内丹("低级")
          elseif 道具.名称=="高级召唤兽内丹"  then
              道具.技能=技能 or 取内丹("高级")
          elseif 道具.名称=="高级魔兽要诀"  then
              道具.技能=技能 or 取高级兽诀名称()
          elseif 道具.名称=="特殊魔兽要诀"  then
               道具.技能=技能 or 取特殊兽诀名称()
         elseif 道具.名称=="魔兽要诀" then
              道具.技能= 技能 or 取低级兽诀名称()
         -- elseif  道具.名称== "吸附石" then
         --      道具.数量 = 等级
         elseif 道具.名称 == "炼妖石" then
            if  等级>=155 then
            道具.等级=155
            else
            道具.等级=等级
            end
        end
    elseif 道具.类型 == "暗器"  then
         道具.等级=ItemData[名称].等级
         道具.耐久=100

    elseif 道具.类型 == "窗口道具"  then
          if  道具.名称=="点化石" then
           道具.技能 =技能
          elseif  道具.名称=="附魔宝珠" then
           道具.等级 = 等级 or math.random(9,12)*10
          elseif  道具.名称=="动物套宝珠" then
           道具.等级 = 等级 or math.random(9,12)*10
          elseif  道具.名称=="灵饰图鉴" then
           道具.等级 =等级
          elseif  道具.名称=="碎石锤" or 道具.名称=="超级碎石锤" then
           道具.等级 =1
          elseif  道具.名称=="神兵图鉴" or 道具.名称=="灵宝图鉴" then
            道具.等级 = 等级
          elseif  道具.名称=="强化符" then
            道具.等级 = 等级
            道具.技能 = 技能
            elseif  道具.名称=="钟灵石" then
            道具.等级 = 等级
            道具.技能 = 技能
          end
    elseif 道具.类型 == "消耗道具"  then
         if  道具.名称=="九转金丹" then
            道具.品质 =等级 or  math.random(3,5)*10

         elseif 道具.名称=="新手玩家礼包"  then
            道具.等级=10
            道具.绑定id=id
          elseif 道具.名称=="烧烤牛肉" or  道具.名称=="烧烤羊肉" or 道具.名称=="烧烤猪肉" or 道具.名称=="烧烤鸭肉" then

       道具.品质=等级  or  math.random(3,5)*10
       elseif 道具.名称 == "百年魂石" or 道具.名称 == "千年魂石" or 道具.名称 == "万年魂石" or 道具.名称 == "十万年魂石" then
           local a=等级
           if a==nil then
              a=取随机数(1,3)
            end
            if a==3 then
              a=取随机数(1,5)
            end

           local b=道具处理类:魂石属性随机(道具.名称,a)
           道具.加成=b.加成
           道具.品质=b.品质


         elseif 名称=="藏宝图" or 名称=="高级藏宝图" or 名称=="玲珑宝图" or 名称=="考古铁铲" then
          local 宝图地图 = {1501,1506,1070,1091,1092,1110,1173,1146,1142,1131,1140,1512,1513,1514,1174}
              道具.地图编号=宝图地图[math.random(1,#宝图地图)]
                local 临时坐标= 地图处理类:Randomloadtion(道具.地图编号)
                道具.x=临时坐标.x
                道具.y=临时坐标.y
   end




    elseif 道具.类型 == "武器" or 道具.类型 == "衣服" or 道具.类型 == "项链" or 道具.类型 == "头盔" or 道具.类型 == "腰带" or 道具.类型 == "鞋子"  then
      道具.等级 = ItemData[名称].等级
      道具.三围属性={}
      道具.耐久度=500
      道具.五行=生成五行()
      道具.鉴定=true
      道具.锻造数据={}
      道具.符石={最大孔数=0,最小孔数=0}
      if 道具.类型 == "武器" then
        道具.伤害=math.floor(道具.等级/10*30+20)
        道具.命中=math.floor(道具.等级/10*35+25)
        elseif 道具.类型 == "衣服"  then
        道具.防御=math.floor(道具.等级/10*15+25)
        elseif 道具.类型 == "项链"  then
        道具. 灵力=math.floor(道具.等级/10*12+5)
        elseif 道具.类型 == "头盔"  then
        道具.防御=math.floor(道具.等级/10*5+5)
        道具.魔法=math.floor(道具.等级/10*10+5)
        elseif 道具.类型 == "腰带"  then
        道具.防御=math.floor(道具.等级/10*5+5)
        道具.气血=math.floor(道具.等级/10*20+10)
        elseif 道具.类型 == "鞋子"  then
        道具.防御=math.floor(道具.等级/10*5+5)
        道具.敏捷=math.floor(道具.等级/10*3+5)
      end
    elseif 道具.类型== "坐骑道具" and 道具.名称 ~="摄灵珠" then
      local sj ={"速度","气血","伤害","灵力","防御"}
      道具.境界 = 1
      道具.耐久 = 500
      道具.属性 = sj[math.random(5)]
    end
       return 道具
end
function 取主动副宠技能名称()
      local 临时名称 = {"水攻","杀气诀","后发制人","横扫千军","壁垒击破","破釜沉舟","反间之计","落岩","五雷咒","落雷符","离魂符","失魂符","失心符","碎甲符","催眠符","落魄符","失忆符",
"雷击","追魂符","定身符","唧唧歪歪","金刚护法","达摩护体","金刚护法","韦陀护法","烈火","金刚护体","我佛慈悲","一苇渡江","推拿","活血","推气过宫","妙手回春","救死扶伤","解毒",
"水漫金山","舍生取义","楚楚可怜","一笑倾城","满天花雨","雨落寒沙","如花解语","似玉生香","娉婷嬝娜","泰山压顶","飞花摘叶","阎罗令","黄泉之息","判官令","还阳术","尸气漫天","幽冥鬼眼","尸腐毒",
"地狱烈火","修罗隐身","飞砂走石","三昧真火","变身","象形","鹰击","狮搏","威慑","定心术","连环击","奔雷咒","极度疯狂","含情脉脉","魔音摄魂","勾魂","摄魄","盘丝阵","天罗地网","天神护体",
"剑荡四方","五雷轰顶","雷霆万钧","天雷斩","知己知彼","镇妖","错乱","百万神兵","二龙戏珠","清心","惊心一剑","龙卷雨击","龙腾","逆鳞","龙吟","紧箍咒","杨柳甘露","日光华","靛沧海","巨岩破","苍茫树",
"死亡召唤","地裂火","普渡众生","灵动九天","烟雨剑法","飘渺式","日月乾坤","炼气化神","生命之泉","哼哼哈兮","落叶萧萧","荆棘舞","尘土刃","冰川怒","雾杀","血雨","星月之惠","炎护","碎星诀","裂石",
"叱咤风云","断岳势","天崩地裂","浪涌","惊涛怒","谜毒之缚","翻江搅海","移魂化骨","夺魄令","煞气诀","流沙轻音","夺命咒","明光宝烛","地涌金莲","炽火流离","针锋相对","锋芒毕露","诱袭","破击",
"食指大动","匠心·蓄锐","匠心·固甲","当头一棒","神针撼海","杀威铁棒","泼天乱棒","移星换斗","天降灵葫","八凶法阵","云暗天昏","铜头铁臂","无所遁形","呼子唤孙","八戒上身","怨怖之泣","唤灵·魂火",
"月光","唤魔·堕羽","进阶力劈华山","净世煌火","焚魔烈焰","善恶有报","壁垒击破","力劈华山","夜舞倾城", "扶摇万里","神来气旺","进阶力劈华山","上古灵符","进阶善恶有报"}
            return   临时名称[math.random( #临时名称)]
end

function 取被动副宠技能名称()
      local 临时名称 = {"防御","反击","必杀","吸血","强力","偷袭","反震","法术暴击","冥思","法术波动",
             "夜战","隐身","感知","再生","法术连击","毒","幸运","连击","永恒","敏捷","神佑复生","驱鬼","鬼魂术",
             "魔之心","火属性吸收","土属性吸收","水属性吸收","雷属性吸收","迟钝","招架","神迹","精神集中","盾气",
           "合纵","否定信仰","飞行","高级防御","高级反击","高级必杀","高级吸血","高级强力","高级偷袭","高级盾气",
         "高级神迹","高级合纵","高级招架","高级精神集中","津津有味","净台妙谛","出其不意","灵山禅语","理直气壮","溜之大吉","大快朵颐",
         "浮云神马","嗜血追击","须弥真言","灵能激发","龙魂","苍鸾怒击","从天而降","大快朵颐","北冥之渊","逍遥游","凭风借力","水击三千",
         "风起龙游","欣欣向荣","万物之灵（火）","万物之灵（水）","万物之灵（金）","万物之灵（土）","万物之灵（木）","力大无穷（火）","力大无穷（金）",
         "力大无穷（土）","力大无穷（水）","力大无穷（木）","高级反震","高级法术暴击","高级冥思","高级否定信仰","高级法术波动",
       "高级夜战","高级隐身","高级感知","高级再生","高级法术连击","高级毒","高级幸运","高级连击","高级永恒","高级敏捷","高级神佑复生",
     "高级驱鬼","高级鬼魂术","高级魔之心","高级飞行","高级水属性吸收","高级火属性吸收","高级土属性吸收","高级雷属性吸收","高级慧根"}
            return   临时名称[math.random( #临时名称)]
end
function 取低级兽诀名称()
  local 临时名称 = {"防御","反击","必杀","吸血","强力","偷袭","反震","法术暴击","冥思","法术波动",
    "夜战","隐身","感知","再生","法术连击","毒","幸运","连击","永恒","敏捷","神佑复生","驱鬼","鬼魂术",
    "魔之心","水攻","落岩","雷击","烈火","火属性吸收","土属性吸收","水属性吸收","雷属性吸收","迟钝","招架","神迹","精神集中","盾气","合纵","否定信仰","飞行"}
  return 临时名称[math.random( #临时名称)]
end

function 取高级兽诀名称()
   local 临时名称 = {"高级防御","高级反击","高级必杀","高级吸血","高级强力","高级偷袭","高级盾气","高级神迹","高级合纵","高级招架","高级精神集中","高级反震","高级法术暴击","高级冥思","高级否定信仰","高级法术波动","高级夜战","高级隐身","高级感知","高级再生","高级法术连击","高级毒","高级幸运","高级连击","高级永恒","高级敏捷","高级神佑复生","高级驱鬼","高级鬼魂术","高级魔之心","水漫金山","泰山压顶","地狱烈火","奔雷咒","高级飞行","高级慧根"}
    return 临时名称[math.random( #临时名称)]
end

function 取活动兽诀名称()
   local  临时名称 = {"剑荡四方","惊心一剑","死亡召唤"}
    return 临时名称[math.random( #临时名称)]
end

function 取垃圾兽诀名称()
   local  临时名称 = {"高级防御","高级反击","高级盾气","高级神迹","高级合纵","高级招架","高级精神集中","高级反震","高级冥思","高级否定信仰","高级隐身","高级感知","高级再生","高级毒","高级幸运","高级永恒","高级敏捷","高级驱鬼","高级鬼魂术","高级火属性吸收","高级土属性吸收","高级水属性吸收","高级雷属性吸收","高级飞行","高级慧根"}
   return 临时名称[math.random( #临时名称)]
end

function 取道人兽诀名称()
   local  临时名称 = {"高级必杀","高级吸血","高级连击","高级神佑复生","高级魔之心","高级法术连击","高级法术波动","高级法术暴击","高级偷袭","高级强力","高级幸运","高级感知"}
   return 临时名称[math.random( #临时名称)]
end

function 取天命兽诀名称()
   local  临时名称 = {"高级必杀","高级吸血","高级连击","高级神佑复生","高级魔之心","高级法术连击","高级法术波动","高级法术暴击","高级偷袭"}
   return 临时名称[math.random( #临时名称)]
end

function 取特殊兽诀名称()
   local  临时名称 = {"哼哼哈兮", "津津有味","净台妙谛","叱咤风云","出其不意","灵山禅语","无畏布施","理直气壮","溜之大吉","流沙轻音","食指大动","大快朵颐","浮云神马","嗜血追击","须弥真言","天降灵葫","八凶法阵" ,"月光" ,"灵能激发", "龙魂",  "善恶有报" , "壁垒击破", "苍鸾怒击" ,"从天而降" ,"大快朵颐"}
   return 临时名称[math.random( #临时名称)]
end

function 取抽奖兽诀名称()
   local  临时名称 = {"力劈华山","壁垒击破","夜舞倾城","善恶有报","出其不意","灵山禅语","无畏布施","八凶法阵","灵能激发","月光"}
   return 临时名称[math.random( #临时名称)]
end

function 取剧情兽诀名称()
   local  临时名称 = {"力劈华山","壁垒击破","夜舞倾城","善恶有报"}
   return 临时名称[math.random( #临时名称)]
end

function 取礼盒兽诀名称()
   local  临时名称 = {"北冥之渊", "扶摇万里","逍遥游","凭风借力","进阶力劈华山","水击三千","风起龙游","欣欣向荣","万物之灵（金）","万物之灵（土）","万物之灵（木）","力大无穷（土）","力大无穷（水）","力大无穷（木）","神来气旺"}
   return 临时名称[math.random( #临时名称)]
 end
   function 取新年兽诀名称()
   local  临时名称 = {"力劈华山","力劈华山","力劈华山","力劈华山","力劈华山","力劈华山","善恶有报","善恶有报","善恶有报","善恶有报","善恶有报","善恶有报","善恶有报","善恶有报","哼哼哈兮", "津津有味","净台妙谛","叱咤风云","出其不意","灵山禅语","无畏布施","理直气壮","溜之大吉","流沙轻音","食指大动","大快朵颐","浮云神马","嗜血追击","须弥真言","天降灵葫","八凶法阵" ,"月光" ,"灵能激发", "龙魂",  "善恶有报" , "壁垒击破", "苍鸾怒击" ,"从天而降" ,"大快朵颐","力劈华山","壁垒击破","夜舞倾城","善恶有报","出其不意","灵山禅语","无畏布施","八凶法阵","灵能激发","月光","欣欣向荣","无赦魔决","万物之灵（火）","万物之灵（水）","万物之灵（金）","万物之灵（土）","万物之灵（木）","力大无穷（火）","力大无穷（金）","力大无穷（土）","力大无穷（水）","力大无穷（木）"}
   return 临时名称[math.random( #临时名称)]
end

function 取门派闯关兽诀名称()
   local  临时名称 = {"高级水属性吸收","高级火属性吸收","高级土属性吸收","高级雷属性吸收","高级防御","高级反击","高级必杀","高级吸血","高级强力","高级偷袭","高级反震","高级法术暴击","高级冥思","高级法术波动", "高级夜战","高级隐身",}
   return 临时名称[math.random( #临时名称)]
end

function 取傲来点化石名称()
   local  临时名称 = {"高级防御","高级反击","高级必杀","高级吸血","高级强力","高级偷袭","高级盾气","高级神迹","高级合纵","高级招架","高级精神集中","高级反震","高级法术暴击","高级冥思","高级否定信仰","高级法术波动","高级夜战","高级隐身","高级感知","高级再生","高级法术连击","高级毒","高级幸运","高级连击","高级永恒","高级敏捷","高级神佑复生","高级驱鬼","高级鬼魂术","高级魔之心","水漫金山","泰山压顶","地狱烈火","奔雷咒","高级飞行","高级慧根"}
    return 临时名称[math.random( #临时名称)]
end

function 取武器类型(武器)
  local n
  if 武器 == "红缨枪" or 武器== "曲尖枪" or 武器== "锯齿矛" or 武器== "乌金三叉戟" or 武器== "火焰枪" or 武器== "墨杆金钩" or 武器== "玄铁矛" or 武器== "金蛇信" or 武器== "丈八点钢矛" or 武器== "暗夜" or 武器== "梨花" or 武器== "霹雳" or 武器== "刑天之逆" or 武器== "五虎断魂" or 武器== "飞龙在天" or 武器== "天龙破城" or 武器== "弑皇" then
     n = "枪"
   end
  if 武器 == "青铜斧"or 武器== "开山斧"or 武器== "双面斧"or 武器== "双弦钺"or 武器== "精钢禅钺"or 武器== "黄金钺"or 武器== "乌金鬼头镰"or 武器== "狂魔镰"or 武器== "恶龙之齿"or 武器== "破魄"or 武器== "肃魂"or 武器== "无敌"or 武器== "五丁开山"or 武器== "元神禁锢"or 武器== "护法灭魔"or 武器== "碧血干戚"or 武器== "裂天" then
    n = "斧"
  end
  if 武器 == "青铜短剑"or 武器== "铁齿剑"or 武器== "吴越剑"or 武器== "青锋剑"or 武器== "龙泉剑"or 武器== "黄金剑"or 武器== "游龙剑"or 武器== "北斗七星剑"or 武器== "碧玉剑"or 武器== "鱼肠"or 武器== "倚天"or 武器== "湛卢"or 武器== "魏武青虹"or 武器== "灵犀神剑"or 武器== "四法青云"or 武器== "霜冷九州"or 武器== "擒龙" then
    n = "剑"
  end
  if 武器 == "双短剑"or 武器== "镔铁双剑"or 武器== "龙凤双剑"or 武器== "竹节双剑"or 武器== "狼牙双剑"or 武器== "鱼骨双剑"or 武器== "赤焰双剑"or 武器== "墨玉双剑"or 武器== "梅花双剑"or 武器== "阴阳"or 武器== "月光双剑"or 武器== "灵蛇"or 武器== "金龙双剪"or 武器== "连理双树"or 武器== "祖龙对剑"or 武器== "紫电青霜"or 武器== "浮犀" then
    n = "双"
    end
  if 武器 == "五色缎带"or 武器== "幻彩银纱"or 武器== "金丝彩带"or 武器== "无极丝"or 武器== "天蚕丝带"or 武器== "云龙绸带"or 武器== "七彩罗刹"or 武器== "缚神绫"or 武器== "九天仙绫"or 武器== "彩虹"or 武器== "流云"or 武器== "碧波"or 武器== "秋水落霞"or 武器== "晃金仙绳"or 武器== "此最相思"or 武器== "揽月摘星"or 武器== "九霄" then
    n = "飘"
  end
  if 武器 == "铁爪"or 武器== "天狼爪"or 武器== "幽冥鬼爪"or 武器== "青龙牙"or 武器== "勾魂爪"or 武器== "玄冰刺"or 武器== "青刚刺"or 武器== "华光刺"or 武器== "龙鳞刺"or 武器== "撕天"or 武器== "毒牙"or 武器== "胭脂"or 武器== "九阴勾魂"or 武器== "雪蚕之刺"or 武器== "贵霜之牙"or 武器== "忘川三途"or 武器== "离钩" then
    n = "爪"
  end
  if 武器 == "折扇"or 武器== "铁骨扇"or 武器== "精钢扇"or 武器== "铁面扇"or 武器== "百折扇"or 武器== "劈水扇"or 武器== "神火扇"or 武器== "阴风扇"or 武器== "风云雷电"or 武器== "太极"or 武器== "玉龙"or 武器== "秋风"or 武器== "画龙点睛"or 武器== "秋水人家"or 武器== "逍遥江湖"or 武器== "浩气长舒"or 武器== "星瀚" then
    n = "扇"
   end
  if 武器 == "细木棒"or 武器== "金丝魔棒"or 武器== "玉如意"or 武器== "点金棒"or 武器== "云龙棒"or 武器== "幽路引魂"or 武器== "满天星"or 武器== "水晶棒"or 武器== "日月光华"or 武器== "沧海"or 武器== "红莲"or 武器== "盘龙"or 武器== "降魔玉杵"or 武器== "青藤玉树"or 武器== "墨玉骷髅"or 武器== "丝萝乔木"or 武器== "醍醐" then
    n = "棒"
  end
  if 武器 == "松木锤"or 武器== "镔铁锤"or 武器== "八棱金瓜"or 武器== "狼牙锤"or 武器== "烈焰锤"or 武器== "破甲战锤"or 武器== "震天锤"or 武器== "巨灵神锤"or 武器== "天崩地裂"or 武器== "八卦"or 武器== "鬼牙"or 武器== "雷神"or 武器== "混元金锤"or 武器== "九瓣莲花"or 武器== "鬼王蚀日"or 武器== "狂澜碎岳"or 武器== "碎寂" then
    n = "锤"
   end
 if 武器 == "牛皮鞭"or 武器== "牛筋鞭"or 武器== "乌龙鞭"or 武器== "钢结鞭"or 武器== "蛇骨鞭"or 武器== "玉竹金铃"or 武器== "青藤柳叶鞭"or 武器== "雷鸣嗜血鞭"or 武器== "混元金钩"or 武器== "龙筋"or 武器== "百花"or 武器== "吹雪"or 武器== "游龙惊鸿"or 武器== "仙人指路"or 武器== "血之刺藤"or 武器== "牧云清歌"or 武器== "霜陨" then
    n = "鞭"
  end
  if 武器 == "黄铜圈"or 武器== "精钢日月圈"or 武器== "离情环"or 武器== "金刺轮"or 武器== "风火圈"or 武器== "赤炎环"or 武器== "蛇形月"or 武器== "子母双月"or 武器== "斜月狼牙"or 武器== "如意"or 武器== "乾坤"or 武器== "月光双环"or 武器== "别情离恨"or 武器== "金玉双环"or 武器== "九天金线"or 武器== "无关风月"or 武器== "朝夕" then
    n = "环"
  end
  if 武器 == "柳叶刀"or 武器== "苗刀"or 武器== "夜魔弯刀"or 武器== "金背大砍刀"or 武器== "雁翅刀"or 武器== "破天宝刀"or 武器== "狼牙刀"or 武器== "龙鳞宝刀"or 武器== "黑炎魔刀"or 武器== "冷月"or 武器== "屠龙"or 武器== "血刃"or 武器== "偃月青龙"or 武器== "晓风残月"or 武器== "斩妖泣血"or 武器== "业火三灾"or 武器== "鸣鸿" then
    n = "刀"
  end
 if 武器 == "曲柳杖"or 武器== "红木杖"or 武器== "白椴杖"or 武器== "墨铁拐"or 武器== "玄铁牛角杖"or 武器== "鹰眼法杖"or 武器== "腾云杖"or 武器== "引魂杖"or 武器== "碧玺杖"or 武器== "业焰"or 武器== "玉辉"or 武器== "鹿鸣"or 武器== "庄周梦蝶"or 武器== "凤翼流珠"or 武器== "雪蟒霜寒"or 武器== "碧海潮生"or 武器== "弦月" then
    n = "法杖"
  end
  if 武器 == "硬木弓"or 武器== "铁胆弓"or 武器== "紫檀弓"or 武器== "宝雕长弓"or 武器== "錾金宝弓"or 武器== "玉腰弯弓"or 武器== "连珠神弓"or 武器== "游鱼戏珠"or 武器== "灵犀望月"or 武器== "非攻"or 武器== "幽篁"or 武器== "百鬼"or 武器== "冥火薄天"or 武器== "龙鸣寒水"or 武器== "太极流光"or 武器== "九霄风雷"or 武器== "若木" then
    n = "弓弩"
  end
  if 武器 == "琉璃珠"or 武器== "水晶珠"or 武器== "珍宝珠"or 武器== "翡翠珠"or 武器== "莲华珠"or 武器== "夜灵珠"or 武器== "如意宝珠"or 武器== "沧海明珠"or 武器== "无量玉璧"or 武器== "离火"or 武器== "飞星"or 武器== "月华"or 武器== "回风舞雪"or 武器== "紫金葫芦"or 武器== "裂云啸日"or 武器== "云雷万里"or 武器== "赤明" then
    n = "宝珠"
  end
  if 武器 == "钝铁重剑"or 武器== "桃印铁刃"or 武器== "赭石巨剑"or 武器== "壁玉长铗"or 武器== "青铜古剑"or 武器== "金错巨刃"or 武器== "惊涛雪"or 武器== "醉浮生"or 武器== "沉戟天戊"or 武器== "鸦九"or 武器== "昆吾"or 武器== "弦歌"or 武器== "墨骨枯麟"or 武器== "腾蛇郁刃"or 武器== "秋水澄流"or 武器== "百辟镇魂"or 武器== "长息" then
    n = "巨剑"
  end
  if 武器 == "素纸灯"or 武器== "竹骨灯"or 武器== "红灯笼"or 武器== "鲤鱼灯"or 武器== "芙蓉花灯"or 武器== "如意宫灯"or 武器== "玲珑盏"or 武器== "玉兔盏"or 武器== "冰心盏"or 武器== "蟠龙"or 武器== "云鹤"or 武器== "风荷"or 武器== "金风玉露"or 武器== "凰火燎原"or 武器== "月露清愁"or 武器== "夭桃秾李"or 武器== "荒尘" then
    n = "灯笼"
  end
  if 武器 == "油纸伞"or 武器== "红罗伞"or 武器== "紫竹伞"or 武器== "锦绣椎"or 武器== "幽兰帐"or 武器== "琳琅盖"or 武器== "孔雀羽"or 武器== "金刚伞"or 武器== "落梅伞"or 武器== "鬼骨"or 武器== "云梦"or 武器== "枕霞"or 武器== "碧火琉璃"or 武器== "雪羽穿云"or 武器== "月影星痕"or 武器== "浮生归梦"or 武器== "晴雪" then
    n = "伞"
  end
 return n
end

function 取防具性别(武器)
 local n
  if 武器 == "方巾" or 武器== "布帽" or 武器== "面具" or 武器== "纶巾"  or 武器=="缨络丝带"or 武器== "羊角盔" or 武器== "水晶帽" or 武器== "乾坤帽" or 武器== "黑魔冠" or 武器== "白玉龙冠" or 武器== "水晶夔帽"
     or 武器== "曜月嵌星"or 武器== "金丝黑玉冠" or 武器== "白玉琉璃冠" or 武器== "兽鬼珐琅面" or 武器== "紫金磐龙冠" or 武器=="浑天玄火盔" or 武器== "布衣" or 武器== "皮衣" or 武器== "鳞甲" or 武器=="锁子甲"
     or 武器== "紧身衣" or 武器== "钢甲"  or 武器== "夜魔披风" or 武器== "龙骨甲" or 武器== "死亡斗篷" or 武器== "神谕披风" or 武器== "珊瑚玉衣" or 武器== "金蚕披风" or 武器== "乾坤护心甲" or 武器== "蝉翼金丝甲"
     or 武器== "金丝鱼鳞甲" or 武器== "紫金磐龙甲" or 武器== "混元一气甲" then
     n= "男"
   else
       n ="女"
   end
 return n
end

function 取随机物品(lv)
 local sj={
 [10]={"曲尖枪","开山斧","铁齿剑","镔铁双剑","幻彩银纱","天狼爪","铁骨扇","金丝魔棒","镔铁锤","牛筋鞭","精钢日月圈","苗刀","桃印铁刃","红罗伞","竹骨灯","水晶珠","红木杖","铁胆弓","五色飞石","牛皮靴","皮衣","丝绸长裙","布帽","玉钗","缎带"},
 [20]={"锯齿矛","双面斧","吴越剑","龙凤双剑","金丝彩带","幽冥鬼爪","精钢扇","玉如意","八棱金瓜","乌龙鞭","离情环","夜魔弯刀","赭石巨剑","紫竹伞","红灯笼","珍宝珠","白椴杖","紫檀弓","珍珠链","马靴","鳞甲","五彩裙","面具","梅花簪子","银腰带"},
 [30]={"乌金三叉戟","双弦钺","青锋剑","竹节双剑","无极丝","青龙牙","铁面扇","点金棒","狼牙锤","钢结鞭","金刺轮","金背大砍刀","璧玉长铗","锦绣椎","鲤鱼灯","翡翠珠","墨铁拐","宝雕长弓","骷髅吊坠","侠客履","锁子甲","龙鳞羽衣","纶巾","珍珠头带","水晶腰带"},
 [40]={"火焰枪","精钢禅钺","龙泉剑","狼牙双剑","天蚕丝带","勾魂爪","百折扇","云龙棒","烈焰锤","蛇骨鞭","风火圈","雁翅刀","青铜古剑","幽兰帐","芙蓉花灯","莲华珠","玄铁牛角杖","錾金宝弓","江湖夜雨","神行靴","紧身衣","天香披肩","缨络丝带","凤头钗","琥珀腰链"},
 [50]={"墨杆金钩","黄金钺","黄金剑","鱼骨双剑","云龙绸带","玄冰刺","劈水扇","幽路引魂","破甲战锤","玉竹金铃","赤炎环","破天宝刀","金错巨刃","琳琅盖","如意宫灯","夜灵珠","鹰眼法杖","玉腰弯弓","高速之星","绿靴","钢甲","金缕羽衣","羊角盔","媚狐头饰","乱牙咬"},
 [60]={"玄铁矛","乌金鬼头镰","游龙剑","赤焰双剑","七彩罗刹","青刚刺","神火扇","满天星","震天锤","青藤柳叶鞭","蛇形月","狼牙刀","惊涛雪","孔雀羽","玲珑盏","如意宝珠","腾云杖","连珠神弓","风月宝链","追星踏月","夜魔披风","霓裳羽衣","水晶帽","玉女发冠","双魂引"},
 [70]={"金蛇信","狂魔镰","北斗七星剑","墨玉双剑","缚神绫","华光刺","阴风扇","水晶棒","巨灵神锤","雷鸣嗜血鞭","子母双月","龙鳞宝刀","醉浮生","金刚伞","玉兔盏","沧海明珠","引魂杖","游鱼戏珠","碧水青龙","九州履","龙骨甲","流云素裙","乾坤帽","魔女发冠","百窜云"},
 [80]={"丈八点钢矛","恶龙之齿","碧玉剑","梅花双剑","九天仙绫","龙鳞刺","风云雷电","日月光华","天崩地裂","混元金钩","斜月狼牙","黑炎魔刀","沉戟天戊","落梅伞","冰心盏","无量玉璧","碧玺杖","灵犀望月","万里卷云","万里追云履","死亡斗篷","七宝天衣","黑魔冠","七彩花环","圣王坠"}}
 return  sj[lv][math.random(1,#sj[lv])]
end

function 分割文本(szFullString, szSeparator)
  local nFindStartIndex = 1
  local nSplitIndex = 1
  local nSplitArray = {}
  while true do
    local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex)
    if not nFindLastIndex then
        nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString))
        break
    end
    nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1)
    nFindStartIndex = nFindLastIndex + string.len(szSeparator)
    nSplitIndex = nSplitIndex + 1
  end
  return nSplitArray
end
function 敏感文本替换(qq)
  if qq==nil then
      return ""
  end
  local text = qq
  for i=1,#敏感词数据 do
    text = string.gsub(text,敏感词数据[i],"**")
  end
  return text
end

function 生成五行()
 local  随机五行=math.random(5)
 if(随机五行==1)then
    return "金"
  elseif(随机五行==2)then
    return "木"
  elseif(随机五行==3)then
    return "水"
  elseif(随机五行==4)then
    return "火"
  elseif(随机五行==5)then
    return "土"
   end
end

function 取两点距离(src,dst)
    return math.sqrt (math.pow(src.x-dst.x,2) + math.pow(src.y-dst.y,2))
end

门派传送={
大唐官府={z=1198,x=128,y=82}
,化生寺={z=1002,x=30,y=76}
,女儿村={z=1142,x=19,y=49}
,方寸山={z=1135,x=100,y=49}
,龙宫={z=1116,x=69,y=81}
,天宫={z=1111,x=187,y=128}
,五庄观={z=1146,x=30,y=55}
,普陀山={z=1140,x=30,y=23}
,阴曹地府={z=1122,x=62,y=79}
,盘丝洞={z=1513,x=170,y=40}
,狮驼岭={z=1131,x=102,y=83}
,魔王寨={z=1512,x=73,y=32}
,凌波城={z=1150,x=12,y=91}
,神木林={z=1138,x=49,y=105}
,无底洞={z=1139,x=62,y=126}
,花果山={z=1251,x=76,y=25}
,天机城={z=1250,x=132,y=43}
,女魃墓={z=1249,x=78,y=27}
}

Q_召唤兽随机={
[1]={[1]="大海龟",[2]="巨蛙",[3]="海毛虫",[4]="树怪",[5]="野猪",[6]="大蝙蝠",[7]="赌徒",[8]="山贼",[9]="强盗"}
,[2]={[1]="狐狸精",[2]="黑熊",[3]="花妖",[4]="老虎"}
,[3]={[1]="牛妖",[2]="小龙女",[3]="野鬼",[4]="狼",[5]="虾兵",[6]="蟹将"}
,[4]={[1]="龟丞相",[2]="牛头",[3]="马面",[4]="黑熊精",[5]="僵尸"}
,[5]={[1]="雷鸟人",[2]="蝴蝶仙子",[3]="古代瑞兽",[4]="白熊",[5]="黑山老妖"}
,[6]={[1]="天兵",[2]="天将",[3]="地狱战神",[4]="风伯"}
,[7]={[1]="凤凰",[2]="蛟龙",[3]="风伯"}
,[8]={[1]="如意仙子",[2]="芙蓉仙子",[3]="星灵仙子",[4]="巡游天神"}
,[9]={[1]="吸血鬼",[2]="幽灵",[3]="星灵仙子",[4]="巡游天神"}
,[10]={[1]="如意仙子",[2]="芙蓉仙子",[3]="星灵仙子",[4]="巡游天神"}
,[11]={[1]="如意仙子",[2]="芙蓉仙子",[3]="星灵仙子",[4]="巡游天神"}
,[12]={[1]="如意仙子",[2]="芙蓉仙子",[3]="星灵仙子",[4]="巡游天神"}
,[13]={[1]="如意仙子",[2]="芙蓉仙子",[3]="星灵仙子",[4]="巡游天神"}
,[14]={[1]="如意仙子",[2]="芙蓉仙子",[3]="星灵仙子",[4]="巡游天神"}
,[15]={[1]="如意仙子",[2]="芙蓉仙子",[3]="星灵仙子",[4]="巡游天神"}
}
锦衣属性={
   锦衣={
      [1]={
        [0]=500,
        [1]=100,
      },
      [2]={
        [0]=800,
        [1]=120,
      },
      [3]={
        [0]=900,
        [1]=150,
      },
      [4]={
        [0]=1200,
        [1]=300,
      },
      [5]={
        [0]=1500,
        [1]=500,
      },
   },
   光环={
      [1]={
        [0]=1,
        [1]=0.006,
      },
      [2]={
        [0]=1,
        [1]=0.008,
      },
      [3]={
        [0]=1,
        [1]=0.01,
      },
      [4]={
        [0]=1,
        [1]=0.012,
      },
      [5]={
        [0]=1,
        [1]=0.015,
      },
   },
   脚印={
      [1]={
        [0]=1,
        [1]=0.006,
      },
      [2]={
        [0]=1,
        [1]=0.008,
      },
      [3]={
        [0]=1,
        [1]=0.01,
      },
      [4]={
        [0]=1,
        [1]=0.012,
      },
      [5]={
        [0]=1,
        [1]=0.015,
      },
   },
}

装备特技={
弱点击破={消耗=50,对象=3},
破血狂攻={消耗=50,对象=3},
冥王爆杀={消耗=60,对象=3},
诅咒之伤={消耗=40,对象=3},
破碎无双={消耗=80,对象=3},
太极护法={消耗=90,对象=2},
罗汉金钟={消耗=150,对象=1},
慈航普渡={消耗=150,对象=1},
放下屠刀={消耗=30,对象=3},
碎甲术 ={消耗=30,对象=3},
命归术={消耗=130,对象=1},
气归术={消耗=60,对象=1},
凝气诀 ={消耗=60,对象=1},
凝神诀 ={消耗=90,对象=1},
命疗术 ={消耗=90,对象=2},
流云诀 ={消耗=40,对象=2},
啸风诀 ={消耗=80,对象=1},
起死回生={消耗=120,对象=2},
气疗术 ={消耗=30,对象=2},
野兽之力 ={消耗=40,对象=2},
魔兽之印 ={消耗=70,对象=1},
光辉之甲 ={消耗=40,对象=2},
圣灵之甲 ={消耗=80,对象=1},
四海升平 ={消耗=135,对象=1},
水清诀 ={消耗=50,对象=2},
玉清诀 ={消耗=125,对象=2},
冰清诀 ={消耗=100,对象=2},
晶清诀 ={消耗=150,对象=2},
笑里藏刀={消耗=40,对象=3},
流云诀 ={消耗=40,对象=2},
}
门派代号={大唐官府="dt",天机城="tjc",花果山="hgs",女魃墓="nbm",化生寺="hs",女儿村="nr",方寸山="fc",天宫="tg",龙宫="lg",普陀山="pt",五庄观="wz",狮驼岭="st",魔王寨="mw",盘丝洞="ps",阴曹地府="df",凌波城="lb",神木林="sm",无底洞="wd"}
封妖地点={
 {地图=1501,等级=20,卡片=1,怪物={"大海龟","巨蛙","海毛虫"}}
,{地图=1193,等级=30,卡片=1,怪物={"骷髅怪","蛤蟆精","羊头怪"}}
,{地图=1110,等级=40,卡片=1,怪物={"大蝙蝠","强盗","赌徒"}}
,{地图=1110,等级=50,卡片=1,怪物={"大蝙蝠","强盗","赌徒"}}
,{地图=1173,等级=60,卡片=2,怪物={"黑熊","老虎","花妖"}}
,{地图=1110,等级=65,卡片=2,怪物={"黑山老妖","地狱战神","凤凰"}}
,{地图=1092,等级=75,卡片=2,怪物={"蛟龙","风伯","巡游天神"}}
,{地图=1174,等级=85,卡片=2,怪物={"古代瑞兽","白熊","马面"}}
}